% \iffalse meta-comment % % Copyright (C) 2014-2018 by Dominik Siegel % % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.2 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.2 or later is part of all distributions of % LaTeX version 1999/12/01 or later. %% %% To produce the documentation, do the following %% %% latex chemschemex.dtx % % \NeedsTeXFormat{LaTeX2e}[2005/12/01] % \ProvidesPackage{chemschemex} % [2018/01/20 v1.2] % %<*driver> \documentclass{ltxdoc} \usepackage{chemschemex} \usepackage{caption} \usepackage{float} \newfloat{example}{htbp}{los}% \floatname{example}{Example}% \captionsetup{font={footnotesize},textfont={sf},labelfont={sf,bf}} \usepackage{sectsty} \usepackage[hidelinks]{hyperref} \usepackage{fancyvrb} \allsectionsfont{\sffamily} \GetFileInfo{chemschemex.dtx} \EnableCrossrefs \CodelineIndex \OnlyDescription \RecordChanges \newstruct[{R=H},{R=Me},{R=Ph}]{maleimid}{maleimid}{Maleimid}{} \newstruct{cp}{cyclopentadiene}{Cyclopentadiene}{cp} \newstruct[{R=H},{R=Me},{R=Ph}]{product}{}{}{} \date{2018/01/20} \begin{document} \DocInput{chemschemex.dtx} \end{document} % % \fi % % \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \changes{v1.0}{2014/07/15}{Initial version} % \changes{v1.1}{2017/04/02}{Bug within the \textbackslash Struct command fixed} % \changes{v1.1.1}{2017/04/03}{No code changes, documentation attached} % \changes{v1.2}{2018/01/20}{Dependency on etextools (causes some compatibility issues) removed} % % \GetFileInfo{chemschemex.sty} % % % \title{The \CSX{} package\thanks{This document corresponds to \CSX{}~\fileversion{}, dated \filedate.}} % % \author{Dominik Siegel \\ \texttt{dominik.siegel@yahoo.de}} % \newcommand{\CSX}{\textsf{chemschemex}} % \newcommand{\FL}{\textsf{fancylabel}} % \newcommand{\TikZ}{\textsf{Ti\emph{k}Z}} % % \maketitle % % \begin{abstract} % The \CSX{} package provides a comfortable method for the typesetting of (chemical) schemes based on \TikZ{} code, including an automatical structure referencing. % \end{abstract} % % \begin{example} % \begin{minipage}[c]{0.49\linewidth} % \begin{Chemscheme} % \struct{maleimid} % \RightArrow{\struct{cp}}{DEE} % \struct[80\,\%]{product} % \end{Chemscheme} % \end{minipage} % \begin{minipage}[c]{0.5\linewidth} %\begin{verbatim} %\begin{Chemscheme} % \struct{maleimid} % \RightArrow{\struct{cp}}{DEE} % \struct[80\,\%]{product} %\end{Chemscheme} %\end{verbatim} % \end{minipage} % \caption{Chemical scheme (left) produced by a simple code (right).}\label{fig.intro.1} % \end{example} % % \tableofcontents % % \section{Introduction and motivation} % While \LaTeX{} is a powerful tool for mathematical or physical issues the typesetting of chemistry derived problems is still a little bit annoying. When I wrote my thesis in organic chemistry I missed a package which produces chemical schemes as easy as you include a graphic into your document. I simply wanted to draw my structures in \textsc{ChemDraw}, inlcude them into my document and label them. % % The packages \textsf{chemscheme} and \textsf{chemnum} offer a possibility to rerender image files for this purpose. Nevertheless, they only modify a scheme that already exists. This means, that arrows, margins, alignments and other parameters cannot be defined or changed globally in your document. % % By using the \TikZ{} and the \FL{} package (which has actually been written as slave of this package) the \CSX{} package meets all these requirements (see example \ref{fig.intro.1}). % % % % \section{Usage} % \noindent\DescribeMacro{\usepackage} % |\usepackage[]{chemschemex}|\vspace{0.5em} % % \noindent The command above will load the \CSX{} package. It requires the packages \textsf{xkeyval}, \textsf{etextools}, \textsf{xargs}, \textsf{ifthen}, \textsf{suffix}, \TikZ{}, \textsf{graphicx}, and \FL{}. I strongly recommend to read the documentation of the \FL{} package because all referencing functions are provided by this package. It contains a lot of useful options that are not described in this documentation. % % % \newpage % \section{User commands} % % \subsection{Basic commands} % \noindent\DescribeMacro{\customstruct} % |\customstruct[][]{}{}|\vspace{0.5em} % % \noindent The |\customstruct| command typesets the object \textcolor{red}{||} in the first row of a \TikZ{} matrix and the caption \textcolor{blue}{||} in the second row. The caption is supposed to be given as comma-separated list of label(s) and text. The two optional arguments || and || can be used to pass options to \TikZ{} elements (for further information see section \ref{custom}). All the following structure commands are based on |\customstruct|. % % \begin{minipage}{0.27\linewidth} % \begin{Chemscheme} % \customstruct[nodes={draw=blue}] % [draw=red] % {{{label1:},{text}},{{ll2:},{a longer text}}} % {object e.g. image} % \end{Chemscheme} % \end{minipage} % \begin{minipage}{0.6\linewidth} % \begin{verbatim} % \customstruct[nodes={draw=blue}][draw=red] % {{{label1:},{text}}, % {{ll2:},{a longer text}}} % {object e.g. image} % \end{verbatim} % \end{minipage} % % % \vspace{3ex}\noindent\DescribeMacro{\CSXimage} % |\CSXimage[]{}|\vspace{0.5em} % % \noindent The |\CSXimage| command includes the image || using the global options || defined by the |image| option (see section \ref{image}) and the options given by ||. This command is used in all the following structure commands and expands to |\includegraphics[,]{}|. % % % % \subsection{Structure commands} % \vspace{3ex}\noindent\DescribeMacro{\struct} % |\struct[][][][][]{}|\vspace{0.5em} % % \noindent The |\struct| command inlcudes the image ||, sets a fancylabel (therefore it uses || as marker and || as family, default: ||=|CSX|; the use of families is described in the \FL{} package) and prints it. If a || is given, it will also print the caption behind the label. The macro |\CSXlabelsep| can be changed with the |labelseparator| option. % % \begin{minipage}{0.2\linewidth} % \struct[text]{maleimid} % \end{minipage} % \begin{minipage}{0.79\linewidth} % \begin{verbatim} % \struct[text]{maleimid} % expands to: % \customstruct{{{\fancylabel[CSX]{maleimid}\CSXlabelsep},{}}} % {\CSXimage{maleimid}} % \end{verbatim} % \end{minipage} % % % \newpage % \vspace{3ex}\noindent\DescribeMacro{\structalt} % |\structalt[][][][][]{}{}|\vspace{0.5em} % % \noindent The |\structalt| command includes an image || but the labeling corresponds to ||. % % \begin{minipage}{0.2\linewidth} % \structalt{product}{product_num} % \end{minipage} % \begin{minipage}{0.7\linewidth} % \begin{verbatim} % \structalt{product}{product_num} % expands to: % \customstruct{{{\fancylabel[CSX]{product}},{}}} % {\CSXimage{product_num}} % \end{verbatim} % \end{minipage} % % % \vspace{3ex}\noindent\DescribeMacro{\struct*} % \noindent\DescribeMacro{\structalt*} % |\struct*[][][][][]{}|\\ % |\structalt*[][][][][]{}{}|\vspace{0.5em} % % \noindent The |\struct*| and |\structalt*| commands do the same as the corresponding nonstarred versions but use |\fancylabel*| instead of |\fancylabel|. This means, that a label for this structure will be defined but not printed. % % \begin{minipage}{0.2\linewidth} % \struct*{maleimid} % \end{minipage} % \begin{minipage}{0.7\linewidth} % \begin{verbatim} % \struct*{maleimid} % expands to: % \customstruct{{{\fancylabel*[CSX]{maleimid}},{}}} % {\CSXimage{maleimid}} % \end{verbatim} % \end{minipage} % % % \vspace{3ex}\noindent\DescribeMacro{\struct-} % |\struct-[][][][]{}|\vspace{0.5em} % % \noindent The |\struct-| command includes an image || without any labeling. % % \begin{minipage}{0.2\linewidth} % \struct-[text]{maleimid} % \end{minipage} % \begin{minipage}{0.7\linewidth} % \begin{verbatim} % \struct-[text]{maleimid} % expands to: % \customstruct{{{},{text}}} % {\CSXimage{maleimid}} % \end{verbatim} % \end{minipage} % % % % % \vspace{3ex}\noindent\DescribeMacro{\newstruct} % |\newstruct[]{}{}{}{}|\vspace{0.5em} % % \noindent If you want to use substructures you have to define them in the preamble. The optional argument || is a comma-separated list of subcaptions. Whenever you want to refer to them you just have to use their numbers. In this example the first entry (|R=H|) gets the number 1, the second entry (|R=Me|) gets the number 2 and so on. If you use a structure without substructures it is not necessary to use |\newstruct|. However, the |\newstruct| command defines the name (and Name) und abbreviation of the structure what allows you to use the commands |\structname|, |\Structname| and |\structabbr| for this structure.\vspace{2ex} % % \begin{minipage}{0.9\linewidth} % \begin{verbatim} %\newstruct[{R=H},{R=Me},{R=Ph}]{product}{}{}{} % \end{verbatim} % \end{minipage} % % \vspace{3ex}\noindent\textbf{Note:} All of the following structure commands assume that |\newstruct| has been used for the filename || before. % % \vspace{3ex}\noindent\DescribeMacro{\Struct} % |\Struct[][][][]{}{}|\vspace{0.5em} % % \noindent To use the |\Struct| command, the structure and its substructure have to be defined by the |\newstruct| command. It inlcudes the image ||, sets the sublabels given in the comma-separated list of || and prints each sublabel with the subcaption previously given to the |\newstruct| command (one line per sublabel). % % \begin{minipage}{0.2\linewidth} % \Struct{1,2,3}{product} % \end{minipage} % \begin{minipage}{0.7\linewidth} % \begin{verbatim} % \Struct{1,2,3}{product} % expands to: % \customstruct{{{\fancysublabel[CSX]{product}{1}\CSXlabelsep},{R=H}}, % {{\fancysublabel[CSX]{product}{2}\CSXlabelsep},{R=Me}}, % {{\fancysublabel[CSX]{product}{3}\CSXlabelsep},{R=Ph}}} % {\CSXimage{product}} % \end{verbatim} % \end{minipage} % % \vspace{3ex}\noindent\DescribeMacro{\Struct*} % |\Struct*[][][][]{}{}|\vspace{0.5em} % % \noindent To use the |\Struct*| command, the structure and its substructure have to be defined by the |\newstruct| command. It inlcudes the image ||, sets the sublabels given in the comma-separated list of || and prints each sublabel without its subcaption previously given to the |\newstruct| command. % % \begin{minipage}{0.2\linewidth} % \Struct*{1,3}{product} % \end{minipage} % \begin{minipage}{0.7\linewidth} % \begin{verbatim} % \Struct*{1,3}{product} % expands to: % \customstruct{{{\fancysublabel[CSX]{product}{1,3}},{}}} % {\CSXimage{product}} % \end{verbatim} % \end{minipage} % % % \vspace{3ex}\noindent\DescribeMacro{\Structalt} % |\Structalt[][][][]{}{}{}|\vspace{0.5em} % % \noindent Works like the |\Struct| command but includes the image ||. Labeling corresponds to ||. % % % \vspace{3ex}\noindent\DescribeMacro{\Structalt*} % |\Structalt*[][][][]{}{}{}|\vspace{0.5em} % % \noindent Works like the |\Struct*| command but includes the image ||. Labeling corresponds to ||. % % % \vspace{3ex}\noindent\DescribeMacro{\structname} % |\structname{}|\vspace{0.5em} % % \noindent Prints the name of the structure || that has been previously defined by the |\newstruct| command. This command is recommended for the chemical name without a leading capital letter (inside a sentence). % % % \vspace{3ex}\noindent\DescribeMacro{\Structname} % |\Structname{}|\vspace{0.5em} % % \noindent Prints the name of the structure || that has been previously defined by the |\newstruct| command. This command is recommended for the chemical name with a leading capital letter (at the beginning of a sentence). % % % \vspace{3ex}\noindent\DescribeMacro{\structabbr} % |\structabbr{}|\vspace{0.5em} % % \noindent Prints the abbreviation of the structure || that has been previously defined by the |\newstruct| command. % % % % % \subsection{The Chemscheme environment} % % \noindent\DescribeEnv{Chemscheme} % |\begin{Chemscheme}...structure code...\end{Chemscheme}|\vspace{0.5em} % % \noindent If a structure command appears outside a |Chemscheme| environment each command will typeset the image and caption in its own matrix. This causes no kind of adjustment. % % \begin{minipage}{0.3\linewidth} % \struct{cp} % \struct[long caption]{maleimid} % \end{minipage} % \begin{minipage}{0.59\linewidth} % \begin{verbatim} % \struct{cp} % \struct[long caption]{maleimid} % \end{verbatim} % \end{minipage} % % \noindent But if structure commands appear inside a |Chemscheme| environment all images and captions are printed in one matrix. This causes adjustment of the image (by default center) and the caption row (by default top) according to the \TikZ{} style |CSXmatrix|. % % % \begin{minipage}{0.3\linewidth} % \begin{Chemscheme} % \struct{cp} % \struct[long caption]{maleimid} % \end{Chemscheme} % \end{minipage} % \begin{minipage}{0.59\linewidth} % \begin{verbatim} % \begin{Chemscheme} % \struct{cp} % \struct[long caption]{maleimid} % \end{Chemscheme} % \end{verbatim} % \end{minipage} % % % \vspace{3ex}\noindent\DescribeMacro{\ChemschemeNextRow} % |\ChemschemeNextRow[]|\vspace{0.5em} % % \noindent If you want to use the matrix adjustment over multiple lines you can produce a 'linebreak' using the |\ChemschemeNextRow| command. The optional argument || allows you to define the space between the rows. % % \begin{minipage}[c]{0.49\linewidth} % \begin{Chemscheme} % \struct{maleimid} % \RightArrow{\struct{cp}}{DEE} % \struct[80\,\%]{product} % \ChemschemeNextRow[10pt] % \struct[80\,\%]{product} % \LeftArrow{\struct{cp}}{DEE} % \struct{maleimid} % \end{Chemscheme} % \end{minipage} % \begin{minipage}[c]{0.5\linewidth} %\begin{verbatim} %\begin{Chemscheme} % \struct{maleimid} % \RightArrow{\struct{cp}}{DEE} % \struct[80\,\%]{product} % \ChemschemeNextRow[10pt] % \struct[80\,\%]{product} % \LeftArrow{\struct{cp}}{DEE} % \struct{maleimid} %\end{Chemscheme} %\end{verbatim} % \end{minipage} % % \begin{minipage}[c]{0.49\linewidth} % \begin{Chemscheme} % \struct{maleimid} % \RightArrow{\struct{cp}}{DEE} % \struct[80\,\%]{product} % \end{Chemscheme} % \begin{Chemscheme} % \struct[80\,\%]{product} % \LeftArrow{\struct{cp}}{DEE} % \struct{maleimid} % \end{Chemscheme} % \end{minipage} % \begin{minipage}[c]{0.5\linewidth} %\begin{verbatim} %\begin{Chemscheme} % \struct{maleimid} % \RightArrow{\struct{cp}}{DEE} % \struct[80\,\%]{product} %\end{Chemscheme} %\begin{Chemscheme} % \struct[80\,\%]{product} % \LeftArrow{\struct{cp}}{DEE} % \struct{maleimid} %\end{Chemscheme} %\end{verbatim} % \end{minipage} % % % % \vspace{3ex}\noindent\DescribeMacro{\CSXcommands} % |\CSXcommands{}|\vspace{0.5em} % % \noindent The |CSXcommands| macro allows you to draw any \TikZ{} element(s) after the typesetting of the structure matrix. % % \hspace{-30pt}\begin{minipage}[c]{0.39\linewidth} % \begin{Chemscheme} % \struct{maleimid} % \RightArrow{\struct{cp}}{DEE} % \Struct{1,2}{product} % \CSXcommands{\draw[->,CSXallarrows,draw=red] % (Scheme\theCSXscheme Caption3Entry1.west) to % ([xshift=-8pt]Scheme\theCSXscheme Caption3Entry1.west) to % node[auto,swap,CSXlabelfont,red]{a} % ([xshift=-8pt]Scheme\theCSXscheme Caption3Entry2.west) to % (Scheme\theCSXscheme Caption3Entry2.west);} % \end{Chemscheme} % \end{minipage} % \begin{minipage}[c]{0.6\linewidth} %\begin{verbatim} %\begin{Chemscheme} % \struct{maleimid} % \RightArrow{\struct{cp}}{DEE} % \Struct{1,2}{product} % \CSXcommands{ % \draw[->,CSXallarrows,draw=red] % (Scheme\theCSXscheme Caption3Entry1.west) to % ([xshift=-8pt]Scheme\theCSXscheme Caption3Entry1.west) to % node[auto,swap,CSXlabelfont,red]{a} % ([xshift=-8pt]Scheme\theCSXscheme Caption3Entry2.west) to % (Scheme\theCSXscheme Caption3Entry2.west); % } %\end{Chemscheme} %\end{verbatim} % \end{minipage} % % % % \newpage % \subsection{Ref commands} % \noindent\DescribeMacro{\structref} % \noindent\DescribeMacro{\structref*} % \noindent\DescribeMacro{\structsubref} % \noindent\DescribeMacro{\structsubref-} % \noindent\DescribeMacro{\structsubref*} % |\structref[]{}|\\ % |\structref*[]{}|\\ % |\structsubref[]{}{}|\\ % |\structsubref-[]{}{}|\\ % |\structsubref*[]{}{}|\vspace{0.5em} % % \noindent The \CSX{} package defines ref commands that actually do exactly what their analogs from the \FL{} package do, but with |CSX| as default family.\footnote{For further information please have a look into the \textsf{fancylabel} package documentation.} % % % % \vspace{3ex}\noindent\DescribeMacro{\CSXstructref} % \noindent The |\CSXstructref| macro allows you to change the style of all referencing commands that are shown above. The definition is shown below and may be changed as required. %\begin{verbatim} % \newcommand{\CSXstructref}[1]{% % % #1=fancyref command % \textbf{#1}% % } %\end{verbatim} % % % \subsection{Arrows and simples} % % \noindent\DescribeMacro{\customarrow} % |\customarrow[]{