Re: Syntax highlighting
Jef Patat wrote: I'm sorry, I forgot to mention that I know I can do highlighting with Insert->Program Listing. But I would like coloured syntax. The listings package uses multiple keywords to control various colors (background, keywords, comments, ...), which you will need to set. So: 1. Add something to load your favorite color package (most likely color.sty or xcolor.sty) to the preamble. LyX (at least as of version 1.5.6) does not do this automatically unless something else in the document triggers it. For instance, you can say \usepackage[svgnames]{xcolor}, which gives you access to the svgnames palette of colors. 2. Right click the gray (or is it 'gray' for a color and 'grey' for a colour?) handle of the listings inset. Select the language on the Main Settings tab, then switch to the Advanced tab. You can type a question mark (?) in the box to get a list of known parameters. Type in your choices in the format key=value. You can find the relevant parameters in the documentation for the listings package. LyX is fairly smart about adding braces as needed if you just type one entry per line, and as you type parameter names it will show you a list of possible completions on the left (but, AFAIK, won't auto-complete for you, at least as of version 1.5.6). For example (using svgnames) commentstyle=\color{DarkGreen} keywordstyle=\color(Blue} does exactly what you would expect. Note that you can fiddle with other style attributes (such as putting keywords in italics) as well. HTH, Paul
Re: Syntax highlighting
On Sep 19, 2008, at 1:39 PM, Jef Patat wrote: I'm sorry, I forgot to mention that I know I can do highlighting with Insert->Program Listing. But I would like coloured syntax. Sorry - I sent my reply just as I received this. I don't know how to do colored syntax, but would like to know... ;-)
Re: Syntax highlighting
On Sep 19, 2008, at 12:59 PM, Jef Patat wrote: Can anyone tell me how I could achieve syntax highlighting. Use the "listings" feature in LyX, which uses the latex Listings package. Insert->Program Listing Right click on it to edit the settings (language, etc).
Re: Syntax highlighting
Jef Patat wrote: > > Hi, > > up to now I have been using TeXnicCenter but I would like to try out LyX > now. Can anyone tell me how I could achieve syntax highlighting. I have > some documents containing quite some c and C++ source code. I always used > lstloadlanguages but I dont see how I can do this in LyX. > > thanks in advance, > > Jef > I'm sorry, I forgot to mention that I know I can do highlighting with Insert->Program Listing. But I would like coloured syntax. thanks, Jef -- View this message in context: http://n2.nabble.com/Syntax-highlighting-tp1101661p1101727.html Sent from the LyX - Users mailing list archive at Nabble.com.
Syntax highlighting
Hi, up to now I have been using TeXnicCenter but I would like to try out LyX now. Can anyone tell me how I could achieve syntax highlighting. I have some documents containing quite some c and C++ source code. I always used lstloadlanguages but I dont see how I can do this in LyX. thanks in advance, Jef -- View this message in context: http://n2.nabble.com/Syntax-highlighting-tp1101661p1101661.html Sent from the LyX - Users mailing list archive at Nabble.com.
Re: syntax highlighting for inline source code
Add the following to .lyx/externaltemplates (modify accordingly to python, this is C++ (cpp) Template CppKod GuiName "[C++ $$Basename]" HelpText Snyggar till C++ kod HelpTextEnd InputFormat cpp FileFilter "*.{cpp,h,hpp,c}" ViewCommand "nedit $$FName" EditCommand "nedit $$FName" AutomaticProduction true Format LaTeX Product "{\\small \\input{$$FName.tex} }" UpdateFormat latex #UpdateCommand "highlight -A -L -t 4 -I -S cpp -f -r -q $$FName -o $$FName.tex" UpdateResult "$$FName.tex" FormatEnd Format PDFLaTeX FormatEnd TemplateEnd You have to add the corresponding filetypes and converters in the lyx configuration, or simply add these lines to .lyx/preferences: \format "cpp" "cpp" "C++" "" "" "nedit" \converter "cpp" "latex" "highlight -A -L -t 4 -I -S cpp -f -r -q $$FName -o $$FName.tex" "" This should do the trick. Remember to change cpp to something python-ish. This is for lyx 1.4 and above, below that, search the mailing list for a similar posting.
Re: syntax highlighting for inline source code
John Pye wrote: Hi all In some Latex documentation for various things, I have seen source code snippets inserted that show up nicely with syntax highlighting. Is there any way I can do that with LyX? So for example, let's say I write an algorithm using some python code. I want to put the code into a report, and explain it. Where the code appears in my report, I would like the keywords to appear bold, and the variables to appear blue, etc, etc -- but I want LyX to sort that all out automatically. It seems that the 'highlight' tool will be of use, however I'm not sure how one can use it: http://www.andre-simon.de/index.html This would be a bit like using the 'conversion filters' used for graphics, but it would need to apply somehow to text. I'd be quite happy with an ERT way of doing this -- anything really. Lyx does not have direct support, but yes - there is an ERT way. \usepackage{listings} in the preamble, then have a look at http://www.ctan.org/tex-archive/macros/latex/contrib/listings/listings-1.3.pdf for details on how you use it. This package offer: * syntax higlighting for: - most programming languages, included - your own custom languages, if you set that up * customizable, you can decide what the highlight will look like * highlighting for code that you type into ERT * higlighting for complete source code files that you include without having to type them into lyx. Very convenient, change the real source and your lyx document changes too. . . Don't be scared by the 50 pages of pdf documentation, getting started with python should be as simple as: \lstset{language=Python} \begin{lstlisting} if (a == 5) x = y+3; else x=17; \end{lstlisting} Or: \lstinputlisting{myfile.py} to pull in an entire file. It doesn't have to be the entire file, you can use more arguments to pull out just the lines you want. Helge Hafting
syntax highlighting for inline source code
Hi all In some Latex documentation for various things, I have seen source code snippets inserted that show up nicely with syntax highlighting. Is there any way I can do that with LyX? So for example, let's say I write an algorithm using some python code. I want to put the code into a report, and explain it. Where the code appears in my report, I would like the keywords to appear bold, and the variables to appear blue, etc, etc -- but I want LyX to sort that all out automatically. It seems that the 'highlight' tool will be of use, however I'm not sure how one can use it: http://www.andre-simon.de/index.html This would be a bit like using the 'conversion filters' used for graphics, but it would need to apply somehow to text. I'd be quite happy with an ERT way of doing this -- anything really. Cheers JP -- John Pye School of Mechanical and Manufacturing Engineering The University of New South Wales Sydney NSW 2052 Australia t +61 2 9385 5127 f +61 2 9663 1222 mailto:john.pye_AT_student_DOT_unsw.edu.au http://pye.dyndns.org/
Re: Editors for LaTeX-files with syntax highlighting
Lars Gullik Bjønnes writes: > That sounds like a thoroughly bad idea. It is true that sometimes you > can edit .lyx files with an editor, but that is only because of > limitations in LyX. IMHO the best view of .lyx files is that they > should be treated as "hackable" binary files. (I assume that you mean "editing a LyX file by hand" is a bad idea rather than "having a syntax file for LyX files".) Why? I do this all the time (with care, of course). When I need to change 75 instances of "my_images.eps" to "my_images.tif", etc. Or whenever I need to do any search-and-replace that involves ERTs -- let's say, for example, that I want to replace all references to "Tiros-Translations" with "Tiros-\hspace{-0.1em}Translations" -- or is this now possible from within LyX in newer versions? -Kevin -- Kevin Pfeiffer <[EMAIL PROTECTED]> Tiros-Translations
Re: Editors for LaTeX-files with syntax highlighting
Hi folks, I come from a purely humanities background, and the interesting thing about what has been said here is that, the more I use lyx, the more I realise that I need to know tex/latex. For that reason I am now patiently going through beginners latex books, using gedit- I am not yet ready to face emacs+auctex. (I use emacs only for the most basic of editing when X won't behave and I need to use a console to fix it). This list and the issues discussed on it have brought me to the realisation that I actually need to learn latex in order to make the best use of lyx. Per haps I may eventually cease using lyx, but I doubt it: lyx has replaced all "normal" word processors in my life: the quality of it's output on the printed page, and in other formats, is infinitely superior to any other writing tool I have used. Knowing latex more deeply can only improve my use of it. :-) Generally, a big thank you to everyone on this list, because just reading through your comments is an invaluable learning experience for me. And, of course, to the lyx developers, latex authors, Donald Knuth,and is there anyone I have forgotten? (Of course there is!) Cheers Bruce On Wed, 2006-02-08 at 09:27 +, Eric S Fraga wrote: > On Fri, Feb 03, 2006 at 09:51:26AM -0500, Dimitrios Diamantaras wrote: > > [...] In fact I am liking the > > Emacs-AUCTeX-preview-latex combination so much that I have been working > > on it exclusively lately, even though about a year ago I thought I would > > never need anything but Lyx (I am a LaTeX user for many years, though, > > and know quite a few of the commands I need---Lyx is perfect for those > > who don't). > > Thanks for saying this. I had been feeling, in a funny kind of way, guilty > because I've also been using Emacs et al. almost exclusively for a while now > despite being a long time LyX user (but a longer time LaTeX user, I must > admit). What's done it for me, at the moment, is reftex which provides an > easier interface to references for somebody like me that does not like using > the mouse. > > But I still think LyX is absolutely fantastic and it's my first port-of-call > when I can't remember how to do something in LaTeX!! > > cheers, > eric
Re: Editors for LaTeX-files with syntax highlighting
Kevin Pfeiffer <[EMAIL PROTECTED]> writes: | Uwe Stöhr writes: | > the next version of the windows installer will have support for | > editors with which LaTeX-files can be viewed with highlighted syntax. | | A side question -- does anyone know of further developments of a (vim) | syntax file for the LyX file format? Someone had posted the beginnings | of one a while ago. That sounds like a thoroughly bad idea. It is true that sometimes you can edit .lyx files with an editor, but that is only because of limitations in LyX. IMHO the best view of .lyx files is that they should be treated as "hackable" binary files. -- Lgb
Re: Editors for LaTeX-files with syntax highlighting
On Fri, Feb 03, 2006 at 09:51:26AM -0500, Dimitrios Diamantaras wrote: > [...] In fact I am liking the > Emacs-AUCTeX-preview-latex combination so much that I have been working > on it exclusively lately, even though about a year ago I thought I would > never need anything but Lyx (I am a LaTeX user for many years, though, > and know quite a few of the commands I need---Lyx is perfect for those > who don't). Thanks for saying this. I had been feeling, in a funny kind of way, guilty because I've also been using Emacs et al. almost exclusively for a while now despite being a long time LyX user (but a longer time LaTeX user, I must admit). What's done it for me, at the moment, is reftex which provides an easier interface to references for somebody like me that does not like using the mouse. But I still think LyX is absolutely fantastic and it's my first port-of-call when I can't remember how to do something in LaTeX!! cheers, eric -- Eric S. Fraga, Department of Chemical Engineering, UCL, London ***.*..**.*.*...***.***.*...*...***.*...
Re: Editors for LaTeX-files with syntax highlighting
Jack M. Lyon wrote: Do you know other editors that offer syntax-highlighting for LaTeX and run on Windows? Thanks for the lists of programs. I've now built in support for the following editors: jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX, (notepad) If no editor is found notepad will be used as viewer for LaTeX. regards Uwe
Re: Editors for LaTeX-files with syntax highlighting
- Original Message - From: "Uwe Stöhr" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Friday, February 03, 2006 12:19 AM Subject: Re: Editors for LaTeX-files with syntax highlighting Jack M. Lyon wrote: Does Kile and Emacs easily run under windows, I mean do they have an own win-installer? many thanks regards Uwe Emacs and Xemacs have their own Windows installers and can be used to program in several languages and send email. Kile doesn't run natively on Windows, but perhaps with Cygwin.
Re: Editors for LaTeX-files with syntax highlighting
Dimitrios Diamantaras wrote: Uwe Stöhr wrote: Jack M. Lyon wrote: Does Kile and Emacs easily run under windows, I mean do they have an own win-installer? many thanks regards Uwe IIRC, texmaker is a Windows Kile-like editor. There are versions of Emacs out there that are precompiled with AUCTeX and preview-latex (actually, one and the same thing in the latest version). I have it running under Windows XP SP2 and it works quite well as long as I don't try to preview in PDFLaTeX mode. Installation was easy, I just had to run an executable. In fact I am liking the Emacs-AUCTeX-preview-latex combination so much that I have been working on it exclusively lately, even though about a year ago I thought I would never need anything but Lyx (I am a LaTeX user for many years, though, and know quite a few of the commands I need---Lyx is perfect for those who don't). To get the precompiled Emacs (I have 22.0.50) with AUCTeX (I have 11.81, but 11.82 is ready, I believe) you can Google emacs+auctex-w32. I just did it, and found this mirror: http://mirrors.ircam.fr/pub/gnu/alpha/gnu/auctex/ Hope this helps. To correct myself, installation is even easier. I just had to unzip a directory, and then emacs runs by executing "runemacs" from the bin subdirectory of that directory.
Re: Editors for LaTeX-files with syntax highlighting
Uwe Stöhr wrote: Jack M. Lyon wrote: Does Kile and Emacs easily run under windows, I mean do they have an own win-installer? many thanks regards Uwe IIRC, texmaker is a Windows Kile-like editor. There are versions of Emacs out there that are precompiled with AUCTeX and preview-latex (actually, one and the same thing in the latest version). I have it running under Windows XP SP2 and it works quite well as long as I don't try to preview in PDFLaTeX mode. Installation was easy, I just had to run an executable. In fact I am liking the Emacs-AUCTeX-preview-latex combination so much that I have been working on it exclusively lately, even though about a year ago I thought I would never need anything but Lyx (I am a LaTeX user for many years, though, and know quite a few of the commands I need---Lyx is perfect for those who don't). To get the precompiled Emacs (I have 22.0.50) with AUCTeX (I have 11.81, but 11.82 is ready, I believe) you can Google emacs+auctex-w32. I just did it, and found this mirror: http://mirrors.ircam.fr/pub/gnu/alpha/gnu/auctex/ Hope this helps.
Re: Editors for LaTeX-files with syntax highlighting
There are probably others out there as well. Context: http://www.context.cx/ PSPad: http://www.pspad.com/ NEdit (via CygWin): http://www.nedit.org/ -- Mael Hilléreau
Re: Editors for LaTeX-files with syntax highlighting
On Friday 03 February 2006 09:19, Uwe Stöhr wrote: > > Does Kile and Emacs easily run under windows, I mean do they have an own > win-installer? > > many thanks > regards Uwe I believe Emacs works ok under windows but requires some major hocus pocus to install it. As for Kile... oh dear. You would need at least kde-libs, kde-base and kde-graphics upon a cygwin environment. Now that probably doesn't come easy at all...
Re: Editors for LaTeX-files with syntax highlighting
Uwe Stöhr wrote: Does Kile and Emacs easily run under windows, I mean do they have an own win-installer? Kile is *nix and MAC GUI Herbert
Re: Editors for LaTeX-files with syntax highlighting
Jack M. Lyon wrote: Does Kile and Emacs easily run under windows, I mean do they have an own win-installer? many thanks regards Uwe
RE: Editors for LaTeX-files with syntax highlighting
Uwe Stoehr wrote: > Do you know other editors that offer syntax-highlighting for LaTeX and > run on Windows? Crimson Editor: http://www.crimsoneditor.com/ Scintilla Text Editor: http://www.scintilla.org LaTeX Editor: http://www.latexeditor.org/ Kile: http://kile.sourceforge.net/ LaTeXEditor: http://www.ntu.edu.sg/home5/pg03053527/latexeditor/ Texmaker: http://www.xm1math.net/texmaker/ Emacs: http://www.math.aau.dk/~dethlef/Tips/introduction.html Nirvana Editor: http://nedit.gmxhome.de/latexmode.html Texmaker: http://www.xm1math.net/texmaker/download.html WinTeX: http://www.tex-tools.de/cms/ LaTexMng: http://www.latexsoft.com/latexmng.htm TeXShell: http://www.projectory.de/texshell/ WinShell: http://www.winshell.de/ There are probably others out there as well. Best wishes, Jack M. Lyon ___ The EDITORIUM Microsoft Word Add-Ins for Publishing Professionals http://www.editorium.com ___ > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 02, 2006 4:56 PM > To: LyX-Users > Subject: Editors for LaTeX-files with syntax highlighting > > > Hello LyXers, > > the next version of the windows installer will have support > for editors > with which LaTeX-files can be viewed with highlighted syntax. > Currently > I have built in support for jEdit, WinShell, TeXnicCenter, > WinEdt, and > WinTeX. > The first editor that is found on the system will be set as > viewer for > LaTeX-files within LyX. > > Do you kow other editors that offer syntax-highlighting for LaTeX and > run on Windows? > > thanks and regards > Uwe >
Re: Editors for LaTeX-files with syntax highlighting
Uwe Stöhr writes: > the next version of the windows installer will have support for > editors with which LaTeX-files can be viewed with highlighted syntax. A side question -- does anyone know of further developments of a (vim) syntax file for the LyX file format? Someone had posted the beginnings of one a while ago. -Kevin -- Kevin Pfeiffer <[EMAIL PROTECTED]> Tiros-Translations
Editors for LaTeX-files with syntax highlighting
Hello LyXers, the next version of the windows installer will have support for editors with which LaTeX-files can be viewed with highlighted syntax. Currently I have built in support for jEdit, WinShell, TeXnicCenter, WinEdt, and WinTeX. The first editor that is found on the system will be set as viewer for LaTeX-files within LyX. Do you kow other editors that offer syntax-highlighting for LaTeX and run on Windows? thanks and regards Uwe
Re: [Feature Request] ERT-Syntax-highlighting
On Tue, 5 Mar 2002 11:50:11 +0100 wrote Niklas Werner <[EMAIL PROTECTED]>: > After hacking loads of ERT into LyX (psfrag...)... > > -> Are there any plans to let LyX behave better in ERT-Mode? ie not > insert \par or \centering (or whatever my paragraph may be), but have an: > \begin{ERT} > do nothing except the ERT > \end{ERT} > (I suppose the 1.20cvs ERT-inset is supposed to behave like this, though > I haven't had the time to check it thoroughly) Do you that besides the "inline-ERT" (toggled with ^L) there is also a LaTeX paragraph style (to be found in the List on the toolbar, also (if I am right) M-p x) Furthermore, the ERT-inset is available also on LyX 1.1.6: the ert-insert command produces an ERT-box you can use for ERT you want to hide: Press ESC-x (or Alt-x on many implementations) to go to the Status-line and write ert-insert (!!Attention: ert-insert != ert-inset !!). > -> furthermore is it remotely possible to have the ERT > syntax-highlighted, or at least having the corresponding brackets and > braces shown? (Maybe use vim's latex.vim-file?) What I was thinking about is a LyX support for psfrag: Is there a way to write a paragraph style for a LaTeX command with 2 arguments? (How is this done for Description??) (otherwise, this is a strong feature request: have Styles with additional arguments. This would also enrich the usability of LyX for commands and environments with optional arguments.) just now, a psfraq Style would only let you replace the command \psfrag{fx}{$f_{x_2}$} with fx}{$f_{x_2}$ in the psfrag Style and with the }{ in ERT :-( This is why I did not write that style yet. Guenter -- [EMAIL PROTECTED]
[Feature Request] ERT-Syntax-highlighting
Hi All! After hacking loads of ERT into LyX (psfrag...)... -> Are there any plans to let LyX behave better in ERT-Mode? ie not insert \par or \centering (or whatever my paragraph may be), but have an: \begin{ERT} do nothing except the ERT \end{ERT} (I suppose the 1.20cvs ERT-inset is supposed to behave like this, though I haven't had the time to check it thoroughly) -> furthermore is it remotely possible to have the ERT syntax-highlighted, or at least having the corresponding brackets and braces shown? (Maybe use vim's latex.vim-file?) Have fun* Niklas