If you read my essay: "OpenSUSE 13.2 Installation Texlive2014+texmaker+lyx"
(a) LyX Chinese
Open LyX directly new start to use, then the input of the Chinese will be compiled failed, suspect? Why does it have no problem with the documentation and the tutorial compiling ...
The reason is that each document is configured differently. You can open "help-LyX Introduction" and create a new file yourself. Then open documents-preferences. You will find that the configuration is different. If the case to change, then you can run Chinese, but there will be a lot of places, inexplicably compiled however, may be some of the settings I did not change, just contact will not change. So the simplest way to do this is to copy LyX to your directory, delete the original content, and then edit it. This is the simplest and most effective way to deal with the vast majority of the writing work, later learned more can be configured on their own
(ii) LyX code highlighting
For programmers, if you want to insert some code, not highlighting is definitely unacceptable. Here's a look at the method.
Open "Documents-preferences", enter "Latex introduction area", append the following code:
\usepackage{listings}\usepackage{xcolor}\lstset{ % line number Numbers=left, % Background box framexleftmargin=10mm, Frame=none, % background color %backgroundcolor=\color[rgb]{1,1,0.76}, backgroundcolor=\color[rgb]{ 245,245,244}, % style Keywordstyle=\bf\color{blue}, identifierstyle=\bf, Numberstyle=\color[rgb ]{0,192,192}, commentstyle=\it\color[rgb]{0,96,96}, stringstyle=\rmfamily\slshape\color[rgb]{128,0,0 }, % display space showstringspaces=false, xleftmargin=2em,% margin xrightmargin=2em, aboveskip=1em}
In this way, in the "Insert-Tex code", you can use the following code to insert the code
< stdio . h > int main (void) { printf ("Hello lyx!"); return 0;} \end{lstlisting}
Effect:
is not good ~ but have to ask one question is that the language supported in the listings package may not be very full. For example, does not support JavaScript,HTML5 and so on.
A list of supported languages can be found in the listings instructions. PDF (16 pages) to learn more about listings You can also check this document
LyX does not support JavaScript's workaround:
Modify the language support files in the installation directory. The path is /usr/local/texlive/2014/texmf-dist/tex/latex/listings/. We can add the following setting information in lstlang1.sty (in the middle of two language definitions)
\[email protected]{javascript}% {morekeywords={typeof,new,true,false,catch,function,return,null,catch, switch,var,if,in,while,do,else,case,break},% morecomment=[l]//,% morecomment=[s]{/*}{*/},% MORESTRING=[B] ",% morestring=[b] ',% }[keywords,comments,strings]%
OK, use "JavaScript" in the language option to implement code highlighting.
There is also a flexible way to add code directly to the introductory area. If you add HTML5 support:
\lstdefinelanguage{html5}[]{html}{ sensitive=false, Morekeywords={canvas}, Tag=[s]}
The same functionality can be achieved by putting the definition code into the introductory area. As follows:
OK, the basic use of lyx should be no problem.
-------
PS: Everything has, this intends to complete my graduation thesis with LyX, to look over the group of instructions only to find the school to set the template .... The Wicked school &&m¥office!
LyX input Chinese and code highlighting