diff options
author | Karl Berry <karl@freefriends.org> | 2011-12-02 23:39:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-12-02 23:39:18 +0000 |
commit | 396e2cc2fa5d8e4b6f6c9e739131f32720e845bb (patch) | |
tree | c3a8abdd4377cd6314275516cc0986a43908dd0d /Master/texmf-dist/doc/latex/chemnum/chemnum-codehelper.tex | |
parent | b7e22d5720b65bafa6dba2f4282093cca3f26c00 (diff) |
chemnum (2dec11)
git-svn-id: svn://tug.org/texlive/trunk@24724 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/chemnum/chemnum-codehelper.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/chemnum/chemnum-codehelper.tex | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/chemnum/chemnum-codehelper.tex b/Master/texmf-dist/doc/latex/chemnum/chemnum-codehelper.tex new file mode 100644 index 00000000000..3583603d3a5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/chemnum/chemnum-codehelper.tex @@ -0,0 +1,224 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% - chemnum - chemnum-codehelper.tex - % +% - a comprehensive approach for the numbering of chemical compounds - % +% ------------------------------------------------------------------------------------- % +% - Clemens NIEDERBERGER - % +% - 2011/12/01 - % +% ------------------------------------------------------------------------------------- % +% - http://www.mychemistry.eu/ - % +% - contact@mychemistry.eu - % +% ------------------------------------------------------------------------------------- % +% - If you have any ideas, questions, suggestions or bugs to report, please feel free - % +% - to contact me. - % +% ------------------------------------------------------------------------------------- % +% - Copyright 2011 Clemens Niederberger - % +% - - % +% - This work may be distributed and/or modified under the - % +% - conditions of the LaTeX Project Public License, either version 1.3 - % +% - of this license or (at your option) any later version. - % +% - The latest version of this license is in - % +% - http://www.latex-project.org/lppl.txt - % +% - and version 1.3 or later is part of all distributions of LaTeX - % +% - version 2005/12/01 or later. - % +% - - % +% - This work has the LPPL maintenance status `maintained'. - % +% - - % +% - The Current Maintainer of this work is Clemens Niederberger. - % +% - - % +% - This work consists of the files chemnum.sty, chemnum_doc_de.tex, - % +% - chemnum_doc_en.tex, chemnum-codehelper.tex, scheme-tmp.eps, scheme-bla.eps, - % +% - README and the derived files chemnum_doc_de.pdf and chemnum_doc_en.pdf - % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% This code is just a copy from the LaTeXdemo environment in the siunitx documentation +% which has been (minimally) adapted and provides environment beispiel with options +% [code and example] (default) +% [code only] +% [code and float] +% +% Clemens NIEDERBERGER, 2011/12/01 +% +% For creating examples with nice highlighting of code, and so +% on; based on the system used in the listings source (lstsample). +\usepackage[final]{listings} +\usepackage{framed} +\makeatletter +\lst@RequireAspects{writefile} +\newsavebox{\beispiel@box} +\lstnewenvironment{beispiel}[1][code and example] + {% + \global\let\lst@intname\@empty + \expandafter\let\expandafter\beispiel@end + \csname beispiel@#1@end\endcsname + \@nameuse{beispiel@#1}% + } + {\beispiel@end} +\newcommand*\beispiel@new[3]{% + \expandafter\newcommand\expandafter*\expandafter + {\csname beispiel@#1\endcsname}{#2}% + \expandafter\newcommand\expandafter*\expandafter + {\csname beispiel@#1@end\endcsname}{#3}% +} +\newcommand*\beispiel@common{% + \setkeys{lst} + { + language=[LaTeX]TeX, + basicstyle={\ttfamily\footnotesize}, % Grundstil + extendedchars=true, + numbers=left, % Zeilennummern + numberstyle=\tiny, % Größe des Zeilennummern + numberblanklines=true, % Leerzeilen nummerieren + gobble=0, % das erste Leerzeichen abschneiden + xleftmargin=20pt, % Einrückung links + breaklines=true, % Zeilenumbruch + literate={ä}{{\"a}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 {Ä}{{\"A}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 {ß}{{\ss}}1, + moredelim=[is][\color{red!25!purple}]{!!}{!!},% Hervorhebung + moredelim=[is][\color{black}]{++}{++}, % Hervorhebung der Keywords rückgängig + commentstyle={\color[named]{Gray}}, + keywordstyle=\color{code}, + texcsstyle=[30]\color{code}, + moretexcs=[30] + { + @m, + arrow, + bf, + chemfig, + chemname, + cmpd, + cmpdinit, + cmpdref, + cmpdreset, + cmpdsetup, + CNlabel, + CNlabelnoref, + CNref, + CNlabelsub, + CNlabelsubnoref, + CNrefsub, + declarecompound, + compound, + compoundprefix, + compoundsuffix, + fcite, + includegraphics, + lstinline, + marker, + penalty, + renewcommand, + schemename, + schemestart, + schemestop, + selectlanguage, + setarrowoffset, + setatomsep, + setcompoundsep, + setdoublesep, + section, + sf, + subsection, + subsubsection, + texorpdfstring, + textcolor, + textnumero, + theffbibliography, + uline + } + }% +} +\newcommand*\beispiel@input[1][\jobname.tmp]{% + \catcode`\^^M=10\relax + \small + \begingroup + \leavevmode + \input{#1}% + \endgroup +} +\beispiel@new{code and example} + {% + \setbox\beispiel@box=\hbox\bgroup + \lst@BeginAlsoWriteFile{\jobname.tmp}% + \beispiel@common + } + {% + \lst@EndWriteFile + \egroup + \colorlet{shadecolor}{yellow!20} + \begin{shaded} + \ifdim\wd\beispiel@box>0.48\linewidth\relax + \begin{minipage}{.9\linewidth} + \hbox to \linewidth{\box\beispiel@box\hss}% + \end{minipage} + \vskip3mm + \begin{minipage}{.9\linewidth} + \beispiel@input + \end{minipage} + \else + \begin{minipage}{0.48\linewidth} + \hbox to\linewidth{\box\beispiel@box\hss}% + \end{minipage} + \hfill + \begin{minipage}{0.48\linewidth} + \beispiel@input + \end{minipage} + \fi + \end{shaded} + } +\beispiel@new{code and float}{% + \colorlet{shadecolor}{yellow!20} + \shaded + \lst@BeginAlsoWriteFile{bsp.tmp}% + \beispiel@common +}{% + \lst@EndWriteFile + \endshaded + \beispiel@input[bsp.tmp] +} +\beispiel@new{code only} + {\colorlet{shadecolor}{yellow!20}\shaded\beispiel@common}{\endshaded} +\makeatother + +\lstset{ + language=[LaTeX]TeX, + basicstyle={\ttfamily}, % Grundstil + extendedchars=true, + numbers=left, % Zeilennummern + numberstyle=\tiny, % Größe des Zeilennummern + numberblanklines=true, % Leerzeilen nummerieren + gobble=0, % das erste Leerzeichen abschneiden + xleftmargin=20pt, % Einrückung links + breaklines=true, % Zeilenumbruch + literate={ä}{{\"a}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 {Ä}{{\"A}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 {ß}{{\ss}}1, + moredelim=[is][\color{myred}]{!!}{!!},% Hervorhebung + moredelim=[is][\color{black}]{++}{++}, % Hervorhebung der Keywords rückgängig + commentstyle={\color[named]{Gray}}, + keywordstyle=\color{code}, + texcsstyle=[30]\color{code}, + moretexcs=[30] + { + @m, + cmpd, + cmpdinit, + cmpdref, + cmpdreset, + cmpdsetup, + CNlabel, + CNlabelnoref, + CNref, + CNlabelsub, + CNlabelsubnoref, + CNrefsub, + declarecompound, + compound, + compoundprefix, + compoundsuffix, + fcite, + lstinline, + penalty, + psfrag, + schemeref, + tableofcontents, + textnumero, + theffbibliography, + uline + } + }%
\ No newline at end of file |