[tex-live] Is it possible to make lstlocal.cfg per LaTeX project work?

Easior Lars 041018006 at fudan.edu.cn
Sun Jul 30 04:46:43 CEST 2017


Hi, all!

The listings package is great. However, it could be enhanced to
configure more than one programming languages by lstset command in
LaTeX source files. For examples, I can add more highlighting keywords to
bash language just as follows:
,--------------------------------------------------------
| \lstset{morekeywords={sudo, apt-get, dnf, emerge, gcc}}
| \begin{lstlisting}[language=bash]
| $ sudo emerge -av emacs
| \end{lstlisting}
`--------------------------------------------------------
I can do the same trick to C language like:
,---------------------------------------------------------
| \lstset{morekeywords={gint, gchar, GtkWidget, gpointer}}
| \begin{lstlisting}[language=bash]
| gpointer fun_callback(GtkWidget *, gpointer);
| \end{lstlisting}
`---------------------------------------------------------
But, I can't do this trick at LaTeX preamble by lstset command.

Throughout google search engine, I found that there is a
lstlocal.cfg and some specific *.prf to reach this end by
putting those ones into TEXMFHOME/tex/latex/listings/ directory.
Unfortunately, those changing would have effects on all of LaTeX
sources. I hope there would be a similar lstlocal.cfg per LaTeX
source file/project. Is it possible?

-- 
致礼,

EL
---------------------------------
对酒当歌,人生几何?譬如朝露,去日苦多。
慨当以慷,忧思难忘。何以解忧?唯有杜康。
青青子衿,悠悠我心。但为君故,沈吟至今。
呦呦鹿鸣,食野之苹。我有嘉宾,鼓瑟吹笙。
明明如月,何时可掇?忧从中来,不可断绝。
越陌度阡,枉用相存。契阔谈宴,心念旧恩。
月明星稀,乌鹊南飞,绕树三匝,何枝可依?
山不厌高,海不厌深。周公吐哺,天下归心。

                        短歌行·曹操
---------------------------------



More information about the tex-live mailing list