%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - chemnum - bsp.tex - % % - a comprehensive numbering method for chemical compounds - % % ------------------------------------------------------------------------------------- % % - Clemens NIEDERBERGER - % % - 2011/11/03 - % % ------------------------------------------------------------------------------------- % % - 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, bsp.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/07/25 % % 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, penalty, renewcommand, schemename, schemestart, schemestop, 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