summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/chemmacros/chemmacros-codehelper.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/chemmacros/chemmacros-codehelper.tex')
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/chemmacros-codehelper.tex600
1 files changed, 600 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros-codehelper.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros-codehelper.tex
new file mode 100644
index 00000000000..51629183677
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros-codehelper.tex
@@ -0,0 +1,600 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% --------------------------------------------------------------------------- %
+% - the CHEMMACROS bundle - %
+% - chemmacros-codehelper.tex - %
+% - macros and commands for chemists - %
+% --------------------------------------------------------------------------- %
+% - Clemens Niederberger - %
+% - 2012/01/27 - %
+% --------------------------------------------------------------------------- %
+% - 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-2012 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. - %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Just to shorten the preamble of the documentation
+%
+% The beispiel environment 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)
+% * [below] (like default but forces example below code)
+% * [ox] (like below but with larger skip)
+% * [code only]
+% * [code and float]
+%
+% For creating examples with nice highlighting of code, and so on; based on the
+% system used in the listings source (lstsample).
+\RequirePackage[final]{listings}
+\RequirePackage{framed,xcolor}
+\RequirePackage[colorinlistoftodos,disable]{todonotes}
+ \xdefinecolor{code}{rgb}{.6,.25,.15}
+ \xdefinecolor{key}{rgb}{0.02,0.48,0.18}
+ \xdefinecolor{myblue}{rgb}{0.02,0.04,0.48}
+ \xdefinecolor{myred}{rgb}{0.65,0.04,0.07}
+ \xdefinecolor{comment}{rgb}{0.4,0.4,0.4}
+ \colorlet{codebackground}{yellow!10}
+ \colorlet{module}{myred}
+
+\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,
+ commentstyle={\color{comment}},
+ keywordstyle=\color{code},
+ texcsstyle=[30]\color{code},
+ moretexcs=[30]
+ {
+ abinitio,
+ aq,
+ ba,
+ bottomrule,
+ cdot,
+ ce,
+ cee,
+ celsius,
+ centering,
+ chemsetup,
+ chemabove,
+ chemfig,
+ chemname,
+ cip,
+ cis,
+ ch,
+ cnsetup,
+ CNMR,
+ color,
+ cstsetup,
+ DeclareInstance,
+ DeclareSIUnit,
+ definecolor,
+ delm,
+ delp,
+ Delta,
+ Dfi,
+ E,
+ el,
+ ElPot,
+ Enthalpy,
+ enthalpy,
+ Entropy,
+ footnotesize,
+ fmch,
+ fpch,
+ fscrm,
+ fscrp,
+ gas,
+ ghs,
+ ghslistall,
+ ghspic,
+ Gibbs,
+ HNMR,
+ Helmholtz,
+ hertz,
+ hspace,
+ includegraphics,
+ insitu,
+ intertext,
+ iupac,
+ IUPAC,
+ joule,
+ Ka,
+ Kb,
+ kilo,
+ Kw,
+ latin,
+ lewis,
+ Lewis,
+ Lfi,
+ listofreactions,
+ lqd,
+ mch,
+ mega
+ meta,
+ mhName,
+ midrule,
+ nicefrac,
+ mmHg,
+ mole,
+ newman,
+ newreaction,
+ NMR,
+ Nu,
+ num,
+ ominus,
+ orbital,
+ ortho,
+ oplus,
+ ox,
+ OX,
+ p,
+ para,
+ pch,
+ per,
+ pgfarrowsdeclarealias,
+ pH,
+ pKa,
+ pKb,
+ pOH,
+ prt,
+ R,
+ redox,
+ renewtagform,
+ renewstate,
+ rightarrow,
+ sample,
+ scriptscriptstyle,
+ scrm,
+ scrp,
+ setatomsep,
+ setbondoffset,
+ setnewstate,
+ sfrac,
+ shorthandoff,
+ si,
+ SI,
+ sisetup,
+ sld,
+ State,
+ subsection,
+ textcolor,
+ textendash,
+ textsuperscript,
+ tiny,
+ toprule,
+ trans,
+ volt,
+ vphantom,
+ vspave,
+ xspace,
+ Z
+ }
+ }%
+}
+
+\newcommand*\beispiel@input[1][\jobname.tmp]{%
+ \catcode`\^^M=5\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}{codebackground}
+ \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{below}
+ {%
+ \setbox\beispiel@box=\hbox\bgroup
+ \lst@BeginAlsoWriteFile{\jobname.tmp}%
+ \beispiel@common
+ }
+ {%
+ \lst@EndWriteFile
+ \egroup
+ \colorlet{shadecolor}{codebackground}
+ \begin{shaded}
+ \begin{minipage}{.9\linewidth}
+ \hbox to \linewidth{\box\beispiel@box\hss}%
+ \end{minipage}
+ \vskip3mm
+ \begin{minipage}{.9\linewidth}
+ \beispiel@input
+ \end{minipage}
+ \end{shaded}
+ }
+
+\beispiel@new{ox}
+ {%
+ \setbox\beispiel@box=\hbox\bgroup
+ \lst@BeginAlsoWriteFile{\jobname.tmp}%
+ \beispiel@common
+ }
+ {%
+ \lst@EndWriteFile
+ \egroup
+ \colorlet{shadecolor}{codebackground}
+ \begin{shaded}
+ \begin{minipage}{.9\linewidth}
+ \hbox to \linewidth{\box\beispiel@box\hss}%
+ \end{minipage}
+ \vskip1.5cm
+ \begin{minipage}{.9\linewidth}
+ \beispiel@input
+ \vskip1cm
+ \end{minipage}
+ \end{shaded}
+ }
+
+\beispiel@new{code and float}{%
+ \colorlet{shadecolor}{codebackground}
+ \shaded
+ \lst@BeginAlsoWriteFile{bsp.tmp}%
+ \beispiel@common
+}{%
+ \lst@EndWriteFile
+ \endshaded
+ \beispiel@input[bsp.tmp]
+}
+
+\beispiel@new{code only}
+ {\colorlet{shadecolor}{codebackground}\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,
+ commentstyle={\color{comment}},
+ keywordstyle=\color{code},
+ texcsstyle=[30]\color{code},
+ moretexcs=[30]
+ {
+ abinitio,
+ aq,
+ ba,
+ bottomrule,
+ cdot,
+ ce,
+ cee,
+ celsius,
+ centering,
+ chemsetup,
+ chemabove,
+ chemfig,
+ chemname,
+ cip,
+ cis,
+ ch,
+ cnsetup,
+ CNMR,
+ color,
+ cstsetup,
+ DeclareInstance,
+ DeclareSIUnit,
+ definecolor,
+ delm,
+ delp,
+ Delta,
+ Dfi,
+ E,
+ el,
+ ElPot,
+ Enthalpy,
+ enthalpy,
+ Entropy,
+ footnotesize,
+ fmch,
+ fpch,
+ fscrm,
+ fscrp,
+ gas,
+ ghs,
+ ghslistall,
+ ghspic,
+ Gibbs,
+ HNMR,
+ Helmholtz,
+ hertz,
+ hspace,
+ includegraphics,
+ insitu,
+ intertext,
+ iupac,
+ IUPAC,
+ joule,
+ Ka,
+ Kb,
+ kilo,
+ Kw,
+ latin,
+ lewis,
+ Lewis,
+ Lfi,
+ listofreactions,
+ lqd,
+ mch,
+ mega,
+ meta,
+ mhName,
+ midrule,
+ nicefrac,
+ mmHg,
+ mole,
+ newman,
+ newreaction,
+ NMR,
+ Nu,
+ num,
+ ominus,
+ orbital,
+ ortho,
+ oplus,
+ ox,
+ OX,
+ p,
+ para,
+ pch,
+ per,
+ pgfarrowsdeclarealias,
+ pH,
+ pKa,
+ pKb,
+ pOH,
+ prt,
+ R,
+ redox,
+ renewtagform,
+ renewstate,
+ rightarrow,
+ sample,
+ scriptscriptstyle,
+ scrm,
+ scrp,
+ setatomsep,
+ setbondoffset,
+ setnewstate,
+ sfrac,
+ shorthandoff,
+ si,
+ SI,
+ sisetup,
+ sld,
+ State,
+ subsection,
+ textcolor,
+ textendash,
+ textsuperscript,
+ tiny,
+ toprule,
+ trans,
+ volt,
+ vphantom,
+ vspave,
+ xspace,
+ Z
+ }
+ }%
+
+\makeatletter
+\def\GetFileInfo#1{%
+ \def\filename{#1}%
+ \def\@tempb##1 ##2 ##3\relax##4\relax{%
+ \def\filedate{##1}%
+ \def\fileversion{##2}%
+ \def\fileinfo{##3}}%
+ \edef\@tempa{\csname ver@#1.sty\endcsname}%
+ \expandafter\@tempb\@tempa\relax? ? \relax\relax}
+\makeatother
+
+\ExplSyntaxOn
+\DeclareDocumentEnvironment { myquote } { o }
+ {
+ \quote
+ \small\sffamily
+ }
+ {
+ \IfNoValueF { #1 }
+ {
+ \par\noindent
+ \parbox { \linewidth } { \raggedleft \normalfont \itshape #1 }
+ }
+ \endquote
+ }
+
+\NewDocumentCommand \paket { sm }
+ {
+ \textsf { #2 }
+ \cs_if_exist:cF { paket @ #2 }
+ {
+ \cs_new_nopar:cpn { paket @ #2 } { }
+ \IfBooleanF { #1 }
+ { \footnote { CTAN: ~ \href { http://www.ctan.org/pkg/#2/ } { #2 } } }
+ }
+ \index { #2 @ \textsf { #2 } }
+ }
+
+% #1: module #2: key #3: value
+\NewDocumentCommand \key { somg }
+ {
+ \textcolor { key } { \texttt { #3 } }
+ \IfNoValueF { #4 } { \texttt { ~=~#4 } }
+ \index { #3 @ \textcolor { key } { \texttt { #3 } } }
+ \IfBooleanT { #1 }
+ {
+ \cs_if_exist:cF { none_#3 }
+ {
+ \cs_new:cpn { none_#3 } {}
+ \marginline { \small \textcolor { red } { \textendash none \textendash } }
+ \label{key:none_#3}
+ }
+ }
+ \IfNoValueF { #2 }
+ {
+ \index
+ {
+ #2 @ \textcolor { module } { \texttt { #2 } } !
+ #3 @ \textcolor { key } { \texttt { #3 } }
+ }
+ \cs_if_exist:cF { #2_#3 }
+ {
+ \cs_new:cpn { #2_#3 } {}
+ \marginline { \small \textcolor { module } { \texttt { #2 } } }
+ \label{key:#2_#3}
+ }
+ }
+ }
+
+\NewDocumentCommand \cmd { omd()od()og }
+ {
+ \textcolor{code} { \texttt { \textbackslash #2 } }
+ \IfNoValueF { #3 } { \texttt { ( #3 ) } }
+ \IfNoValueF { #4 } { \texttt { [ #4 ] } }
+ \IfNoValueF { #5 } { \texttt { ( #5 ) } }
+ \IfNoValueF { #6 } { \texttt { [ #6 ] } }
+ \IfNoValueF { #7 } { \texttt { \{ #7 \} } }
+ \index
+ {
+ \IfNoValueTF { #1 } { #2 } { #1 }
+ @ \textcolor { code } { \texttt { \textbackslash #2 } }
+ }
+ }
+
+\NewDocumentCommand \env { omm }
+ {
+ \texttt{\textcolor{code}{\textbackslash begin}\{#2\}}
+ \IfNoValueF { #1 } { \texttt { [ #2 ] } }
+ \tl_use:N \c_space_tl #3 ~
+ \texttt{\textcolor{code}{\textbackslash end}\{#2\}}
+ \index { #2 @ \texttt { #2 } ~ ( env. ) }
+ }
+
+\NewDocumentCommand \secidx { somo }
+ {
+ \IfBooleanTF { #1 }
+ {
+ \IfNoValueT { #2 }
+ { \index { \IfNoValueTF { #4 } { #3 } { #4 } @ \textbf { #3 } |) } }
+ }
+ {
+ \IfNoValueT { #2 }
+ { \index { \IfNoValueTF { #4 } { #3 } { #4 } @ \textbf { #3 } |( } }
+ }
+ \IfNoValueF { #2 }
+ { \index { \IfNoValueTF { #4 } { #3 } { #4 } @ \textbf { #3 } ! #2 } }
+ }
+
+\NewDocumentCommand \ma { m }
+ { \texttt { \{ #1 \} } }
+
+\NewDocumentCommand \oa { m }
+ { \texttt { [ #1 ] } }
+
+\NewDocumentCommand \da { m }
+ { \texttt { ( #1 ) } }
+
+\cs_new:Nn \chemmacros_doc_todo:nn
+ { \todo [ #1 ] { #2 } }
+\cs_generate_variant:Nn \chemmacros_doc_todo:nn { xn }
+
+\tl_new:N \l_chemmacros_doc_todo_inline_tl
+
+\NewDocumentCommand\TODO{sm}
+ {
+ \group_begin:
+ \IfBooleanTF{#1}
+ { \tl_set:Nn \l_chemmacros_doc_todo_inline_tl {, inline } }
+ { \tl_set:Nn \l_chemmacros_doc_todo_inline_tl { } }
+ \chemmacros_doc_todo:xn
+ {
+ color = myblue,
+ backgroundcolor = white,
+ size = \exp_not:N \small
+ \l_chemmacros_doc_todo_inline_tl
+ }
+ { \textcolor { myblue } { \textbf { TODO: } } \\ #2 }
+ \group_end:
+ }
+
+\ExplSyntaxOff \ No newline at end of file