1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
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
}
}%
|