texlive[49043] Master/texmf-dist: chemfig (1nov18)

commits+karl at tug.org commits+karl at tug.org
Thu Nov 1 23:08:42 CET 2018


Revision: 49043
          http://tug.org/svn/texlive?view=revision&revision=49043
Author:   karl
Date:     2018-11-01 23:08:42 +0100 (Thu, 01 Nov 2018)
Log Message:
-----------
chemfig (1nov18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/generic/chemfig/README
    trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-en.pdf
    trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-en.tex
    trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-fr.pdf
    trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-fr.tex
    trunk/Master/texmf-dist/tex/generic/chemfig/chemfig.tex
    trunk/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex

Modified: trunk/Master/texmf-dist/doc/generic/chemfig/README
===================================================================
--- trunk/Master/texmf-dist/doc/generic/chemfig/README	2018-11-01 01:23:35 UTC (rev 49042)
+++ trunk/Master/texmf-dist/doc/generic/chemfig/README	2018-11-01 22:08:42 UTC (rev 49043)
@@ -2,9 +2,9 @@
 
                 The
           Chemfig package
-               v1.32
+              v1.33
 
-            2018/08/23
+            2018/10/31
 ___________________________________
 
 Maintainer: Christian Tellechea
@@ -29,4 +29,4 @@
 le dessin selon une syntaxe simple, souple et intuitive.
 
 Le dessin est fait avec l'extension tikz. ChemFig fonctionne donc en
-mode dvi ou pdf.
+mode dvi ou pdf.
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-en.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-en.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-en.tex	2018-11-01 01:23:35 UTC (rev 49042)
+++ trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-en.tex	2018-11-01 22:08:42 UTC (rev 49043)
@@ -143,6 +143,7 @@
 \newcommand*\CFval[1]{{\color{teal}\textlangle\textit{#1}\textrangle}}
 \newcommand*\CFkv[2]{\CFkey{#1}{\color{teal}${}={}$}\CFval{#2}}
 \newcommand*\CFparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}\relax \textlangle\textit{empty}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}}\fi\\}
+\newcommand*\CFdelimparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}\relax \textlangle\textit{vide}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}}\fi}
 
 \usepackage[plainpages=false,pdfpagelabels,bookmarks=true,bookmarksopen=true,colorlinks=true,hyperfootnotes=false,filecolor=black,linkcolor=blue,urlcolor=magenta,pdfauthor={Christian TELLECHEA},pdftitle={ChemFig},pdfsubject={Draw 2D molecule with LaTeX},pdfkeywords={ChemFig},pdfcreator={LaTeX}]{hyperref}
 
@@ -213,9 +214,16 @@
 \setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt}
 \part{Introduction}
 \section{New in v1.3}
-\subsection{Key and values system}
-Given the large number of parameters and the number of macros used to specify them, standardization has become necessary, both to simplify the use of \CF and to facilitate the creation of new parameters.
+\subsection{New in 1.33}
+\paragraph{Arguments for submols}
+As of version 1.33, submolecules defined with \verb|\definesubmol| can have arguments, see page~\pageref{definesubmolarg}.
 
+\paragraph{Polymer delilmiters}
+The macro \verb|\polymerdelim| allows to draw delimiters on molecules drawn by \CF, see page~\pageref{polymerdelim}.
+
+\subsection{New in 1.3}
+\paragraph{Key and values system}Given the large number of parameters and the number of macros used to specify them, standardization has become necessary, both to simplify the use of \CF and to facilitate the creation of new parameters.
+
 Most of the settings are now specified \emph{via} the macro \verb|\setchemfig| whose argument is a comma separated list of \chevrons{keys}${}={}$\chevrons{value}. Although still usable for the moment, all macros that specified one or more parameters are now obsolete.
 \begin{center}
 	\color{red}
@@ -228,7 +236,7 @@
 
 Running them sends a warning message about their obsolescence in the log file.
 
-\subsection{The syntax of the \texttt{\textbackslash chemfig} macro}
+\paragraph{The syntax of the \texttt{\textbackslash chemfig} macro}
 \begin{center}
 	\color{red}
 	The starred version of the macro \verb-\chemfig- is now obsolete and will no longer be supported in a future version.
@@ -243,7 +251,7 @@
 	The two optional arguments that the macro \verb-\chemfig- accepts will be removed in a future version.
 \end{center}
 
-\subsection{Keys and their default value}
+\paragraph{Keys and their default value}
 The chemfig settings, identified by their \chevrons{keys} and default \chevrons{value} are:
 \begin{center}
 \begin{longtable}{rl}\hline
@@ -1142,6 +1150,18 @@
 \exemple{Dual alias}/\definesubmol\Me[H_3C]{CH_3}
 \chemfig{*6((-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-)}/
 
+\label{definesubmolarg}The submolecule saved with a \verb|<name>| does not admit an argument when it is called after "\verb|!||". To define a submolecule admitting one or more arguments, place this \verb|<number>| of arguments just after the \verb|<name>|. And the full syntax of \verb|\definesubmol| is:
+
+\centerverb/\definesubmol<number>{<name>}[<code1>]{<code2>}/
+
+In the \verb|<codes>|, the arguments must appear in their usual form "\verb|#<n>|" where \verb|<n>| is the argument number.
+
+\exemple{\texttt{\string\definesubmol} avecwith arguments}/\definesubmol\X1{-[,-0.3,,,draw=none]\footnotesize#1}
+\chemfig{*6((!\X A)-(!\X B)-(!\X C)-(!\X D)-(!\X E)-(!\X F)-)}
+
+\definesubmol{foo}3[#3|\textcolor{#1}{#2}]{\textcolor{#1}{#2}|#3}
+\chemfig{A(-[:135]!{foo}{red}XY)-B(-[:45]!{foo}{green}{W}{zoo})}/
+
 \section{Decorations}
 \subsection{Lewis diagrams}\label{lewis}
 The macro \falseverb{\lewis} allows placement of pairs of electrons, of single electrons, or of empty slots. This syntax is used:
@@ -1472,56 +1492,53 @@
 \chemmove{\draw[-](a)..controls +(60:3em) and +(30:1em)..
     ++(20:2em) ..controls +(210:3em) and +(-120:4em) ..(b);}/
 
-\subsection{Draw a ploymer element}
-The difficulty lies in the display of delimiters (parentheses or brackets) on bond. For this, we will again use the character ``\verb- at -'' to define global nodes that will be used later as anchors for delimiters.
+\subsection{Draw a ploymer element}\label{polymerdelim}
+The macro \verb|\polymerdelim|, until now undocumented and in the test phase, becomes officialy released in \CF with version 1.33. Its syntax is as follows:
 
-We will write a simple macro \verb-\setpolymerbracket-, followed by two characters which define the opening delimiter and closing delimiter.
+\centerverb|\polymerdelim[<keys>=<values>]{<node1>}<node2>}|
 
-Then, the macro \verb-\makebraces- has an argument of the form ``\verb-[<dim up>,<dim down>]-''. These two dimensions are the height and depth of the delimiters from the baseline. The following arguments are the subscript located at the right bottom of the closing delimiter and the names of the 2 nodes at which the opening and closing delimiters will be drawn.
-
-\exemple*{Polymers}|\newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
-\def\makebraces[#1,#2]#3#4#5{%
-	\edef\delimhalfdim{\the\dimexpr(#1+#2)/2}%
-	\edef\delimvshift{\the\dimexpr(#1-#2)/2}%
-	\chemmove{%
-		\node[at=(#4),yshift=(\delimvshift)]
-			{$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim
-			width0pt\right.$};%
-		\node[at=(#5),yshift=(\delimvshift)]
-			{$\left.\vrule height\delimhalfdim depth\delimhalfdim
-			width0pt\right\delimright_{\rlap{$\scriptstyle#3$}}$};}}
-\setpolymerdelim()
-Polyéthylène:
+The effect, after possibly \emph{two} compilations, is to place vertical delimiters at the specified nodes. The parameters are specified via the \chevrons{keys} and \chevrons{values}, which are listed below, default values and actions.
+\begin{center}
+\begin{tabular}{rlp{8cm}}\hline
+	\chevrons{keys} & default \chevrons{values} & Action\\\hline
+	\CFdelimparam{delimiters} & Defines the delimiters. If these delimiters are brackets, write \verb|delimiters={[]}|.\\
+	\CFdelimparam{height} & Defines the height (above the node) of the delimiters.\\
+	\CFdelimparam{depth}  & Defines the depth (below the node) of the delimiters. If the \chevrons{value} is empty, then the depth is equal to the height.\\
+	\CFdelimparam{open xshift}& Defines the horizontal offset of the opening delimiter.\\
+	\CFdelimparam{close xshift}& Defines the horizontal offset of the closing delimiter. If the \chevrons{value} is empty, then this offset becomes opposite to the offset of the opening delimiter.\\
+	\CFdelimparam{indice} & Defines the indice that will be placed at the right bottom of the closing delimiter.\\\hline
+\end{tabular}
+\end{center}
+\exemple*{Polymers}|Polyethylen:
 \chemfig{\vphantom{CH_2}-[@{op,.75}]CH_2-CH_2-[@{cl,0.25}]}
-\makebraces[5pt,5pt]{\!\!n}{op}{cl}
+\polymerdelim[height = 5pt, indice = \!\!n]{op}{cl}
 \bigskip
 
 Polyvinyl chloride:
-\chemfig{\vphantom{CH_2}-[@{op,.75}]CH_2-CH(-[6]Cl)-[@{cl,0.25}]}
-\makebraces[5pt,25pt]{\!\!\!n}{op}{cl}
+\chemfig{\vphantom{CH_2}-[@{op,1}]CH_2-CH(-[6]Cl)-[@{cl,0}]}
+\polymerdelim[height = 5pt, depth = 25pt, open xshift = -10pt, indice = \!\!n]{op}{cl}
 \bigskip
 
 Nylon 6:
 \chemfig{\phantom{N}-[@{op,.75}]{N}(-[2]H)-C(=[2]O)-{(}CH_2{)_5}-[@{cl,0.25}]}
-\makebraces[30pt,5pt]{}{op}{cl}
+\polymerdelim[height = 30pt, depth = 5pt, indice = {}]{op}{cl}
 \bigskip
 
-Polycaprolactame:\setchemfig{atom sep=2em}
+Polycaprolactame:\setchemfig{atom sep = 2em}
 \chemfig{[:-30]-[@{left,.75}]N(-[6]H)-[:30](=[2]O)--[:30]--[:30]--[@{right,0.25}:30]}
-\makebraces[5pt,25pt]{\!\!\!n}{left}{right}
+\polymerdelim[height = 5pt, indice = \!\!n]{left}{right}
 \bigskip
 
-\setpolymerdelim[]
 Polyphénylène sulfide:
 \chemfig{\vphantom{S}-[@{op,.75}]S-(**6(---(-[@{cl,0.25}])---))}
-\makebraces[15pt,15pt]{}{op}{cl}
+\polymerdelim[delimiters = (), height = 15pt, indice = {}]{op}{cl}
 \bigskip
 
 \chemfig{-CH_2-CH([6]-CO-NH-CH_2-NH-CO-CH([4]-CH_2-)([0]-[@{downleft,0.8},2]CH_2
 -CH([2]-CO-NH_2)-[@{downright,0.3},2]CH_2-[,1.5]C?H-))-[@{upleft,0.8},2]CH_2
 -CH([6]-CO-NH_2)-[@{upright,0.3},2]CH_2-[,1.5]CH([6]-CO-NH-CH_2-NH-C?O)-}
-\makebraces[5pt,40pt]{n}{upleft}{upright}
-\makebraces[38pt,7pt]{n}{downleft}{downright}|
+\polymerdelim[delimiters ={[]}, height = 5pt, depth = 40pt, indice = n]{upleft}{upright}
+\polymerdelim[delimiters ={[]}, height = 40pt, depth = 5pt, indice = n]{downleft}{downright}|
 
 \subsection{Draw the symmetrical of a molecule}\label{retournement}
 The two commands \falseverb{\hflipnext} and \falseverb{\vflipnext} allow to draw the symmetrical of the next molecule about a horizontal or vertical axis. If we want to draw more symmetrical molecules, we need to write these commands before each molecule involved.

Modified: trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-fr.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-fr.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-fr.tex	2018-11-01 01:23:35 UTC (rev 49042)
+++ trunk/Master/texmf-dist/doc/generic/chemfig/chemfig-fr.tex	2018-11-01 22:08:42 UTC (rev 49043)
@@ -143,6 +143,7 @@
 \newcommand*\CFval[1]{{\color{teal}\textlangle\textit{#1}\textrangle}}
 \newcommand*\CFkv[2]{\CFkey{#1}{\color{teal}${}={}$}\CFval{#2}}
 \newcommand*\CFparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}\relax \textlangle\textit{vide}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}}\fi\\}
+\newcommand*\CFdelimparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}\relax \textlangle\textit{vide}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}}\fi}
 
 \usepackage[plainpages=false,pdfpagelabels,bookmarks=true,bookmarksopen=true,colorlinks=true,hyperfootnotes=false,filecolor=black,linkcolor=blue,urlcolor=magenta,pdfauthor={Christian TELLECHEA},pdftitle={ChemFig},pdfsubject={Dessiner des molécules 2D avec LaTeX},pdfkeywords={ChemFig},pdfcreator={LaTeX}]{hyperref}
 
@@ -213,9 +214,16 @@
 \setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt,label=--}
 \part{Introduction}
 \section{Nouveau dans la v1.3}
-\subsection{Système de clés et valeurs}
-Compte tenu du grand nombre de paramètres et du nombre de macros qui servent à les spécifier, une uniformisation est devenue nécessaire, autant pour simplifier l'utilisation de \CF que pour faciliter la création de nouveaux paramètres.
+\subsection{Nouveau dans la v1.33}
+\paragraph{Arguments pour les sous-molécules}
+À partir de la version 1.33, les sous-molécules définies avec \verb|\definesubmol| peuvent avoir des arguments, voir page~\pageref{definesubmolarg}.
 
+\paragraph{Délimiteur de polymère}
+La macro \verb|\polymerdelim| permet de tracer des délimiteurs sur des molécules tracées par \CF, voir page~\pageref{polymerdelim}.
+
+\subsection{Nouveau dans la v1.3}
+\paragraph{Système de clés et valeur}Compte tenu du grand nombre de paramètres et du nombre de macros qui servent à les spécifier, une uniformisation est devenue nécessaire, autant pour simplifier l'utilisation de \CF que pour faciliter la création de nouveaux paramètres.
+
 La plupart des \chevrons{paramètres} sont désormais spécifiés \emph{via} la macro \verb|\setchemfig| dont l'argument est une liste de \chevrons{clé}$=$\chevrons{valeur} séparées par des virgules. Bien qu'étant pour l'instant encore utilisables, toutes les macros qui spécifiaient un ou plusieurs paramètres sont désormais obsolètes.
 \begin{center}
 	\color{red}
@@ -228,7 +236,7 @@
 
 Les exécuter envoie un message d'avertissement sur leur obsolescence dans le fichier log.
 
-\subsection{La syntaxe de la macro \texttt{\textbackslash chemfig}}
+\paragraph{La syntaxe de la macro \texttt{\textbackslash chemfig}}
 \begin{center}
 	\color{red}
 	La version étoilée de la macro \verb-\chemfig- est désormais obsolète et ne sera plus supportée dans une future version.
@@ -243,7 +251,7 @@
 	Les deux arguments optionnels que prend la macro \verb-\chemfig- seront supprimés dans une prochaine version
 \end{center}
 
-\subsection{Les clés et leur valeur par défaut}
+\paragraph{Les clés et leur valeur par défaut}
 Les paramètres de chemfig, identifiés par leur \chevrons{clé} et leur \chevrons{valeur} par défaut sont :
 \begin{center}
 \begin{longtable}{rl}\hline
@@ -1132,7 +1140,7 @@
 \exemple{Butane}|\definesubmol\xx{C(-[::+90]H)(-[::-90]H)}
 \chemfig{[:15]H-!\xx-!\xx-!\xx-!\xx-H}|
 
-La commande \falseverb{\definesubmol} admet un argument optionnel et sa syntaxe complète est la suivante :
+La commande \falseverb{\definesubmol} admet un argument optionnel et sa syntaxe est la suivante :
 \centerverb/\definesubmol{<nom>}[<code1>]{<code2>}/
 \medskip
 
@@ -1142,6 +1150,18 @@
 \exemple{Alias dual}/\definesubmol\Me[H_3C]{CH_3}
 \chemfig{*6((-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-)}/
 
+\label{definesubmolarg}La sous-molécule sauvegardée via un \verb|<nom>| n'admet pas d'argument lorsqu'elle est appelée après «\verb|!|». Pour définir une sous-molécule admettant un ou plusieurs argument, il faut écrire ce \verb|<nombre>| d'arguments juste après le \verb|<nom>|. La syntaxe complète de \verb|\definesubmol| est donc:
+
+\centerverb/\definesubmol<nombre>{<nom>}[<code1>]{<code2>}/
+
+Dans les \verb|<codes>|, les arguments doivent figurer sous leur forme habituelle «\verb|#<n>|» où \verb|<n>| est le numéro de l'argument.
+
+\exemple{\texttt{\string\definesubmol} avec arguments}/\definesubmol\X1{-[,-0.3,,,draw=none]\footnotesize#1}
+\chemfig{*6((!\X A)-(!\X B)-(!\X C)-(!\X D)-(!\X E)-(!\X F)-)}
+
+\definesubmol{foo}3[#3|\textcolor{#1}{#2}]{\textcolor{#1}{#2}|#3}
+\chemfig{A(-[:135]!{foo}{red}XY)-B(-[:45]!{foo}{green}{W}{zoo})}/
+
 \section{Décorations}
 \subsection{Formule de Lewis}\label{lewis}
 La macro \falseverb{\lewis} permet de placer des paires d'électrons, des électrons ou une lacune. On utilise cette syntaxe :
@@ -1472,56 +1492,53 @@
 \chemmove{\draw[-](a)..controls +(60:3em) and +(30:1em)..
     ++(20:2em) ..controls +(210:3em) and +(-120:4em) ..(b);}/
 
-\subsection{Dessiner un élément de polymère}
-La difficulté réside dans le fait d'afficher des délimiteurs (parenthèses ou crochets) sur des liaisons. Pour cela, on va encore définir avec le caractère «\verb- at -» des nœuds globaux que l'on utilisera ensuite pour qu'ils servent d'ancre aux délimiteurs.
+\subsection{Dessiner un élément de polymère}\label{polymerdelim}
+La macro \verb|\polymerdelim|, jusqu'alors non documentée et en phase de test, fait avec la version 1.33 son entrée officielle dans le package \CF. Sa syntaxe est la suivante :
 
-Nous allons écrire une macro toute simple \verb-\setpolymerbracket- dont les deux caractères qui suivent définissent le délimiteur ouvrant et le délimiteur fermant.
+\centerverb|\polymerdelim[<clés>=<valeurs>]{<nœud1>}<nœud2>}|
 
-Ensuite, la macro \verb-\makebraces- admettra un argument de la forme«\verb-[<dim up>,<dim down>]-». Ces deux dimensions seront la hauteur et la profondeur des délimiteurs par rapport à la ligne de base. Les arguments suivants seront l'indice placé après le délimiteur fermant puis les noms des 2 nœuds où doivent être placés les délimiteurs ouvrants et fermants.
-
-\exemple*{Polymères}|\newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
-\def\makebraces[#1,#2]#3#4#5{%
-	\edef\delimhalfdim{\the\dimexpr(#1+#2)/2}%
-	\edef\delimvshift{\the\dimexpr(#1-#2)/2}%
-	\chemmove{%
-		\node[at=(#4),yshift=(\delimvshift)]
-			{$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim
-			width0pt\right.$};%
-		\node[at=(#5),yshift=(\delimvshift)]
-			{$\left.\vrule height\delimhalfdim depth\delimhalfdim
-			width0pt\right\delimright_{\rlap{$\scriptstyle#3$}}$};}}
-\setpolymerdelim()
-Polyéthylène:
+L'effet, après éventuellement \emph{deux} compilations, est de positionner des délimiteurs verticaux aux nœuds spécifiés. Les paramètres sont spécifiés via les \chevrons{clés} et les \chevrons{valeurs} dont voici la liste, les valeurs par défaut et les actions.
+\begin{center}
+\begin{tabular}{rlp{8cm}}\hline
+	\chevrons{clés} & \chevrons{valeurs} par défaut & Action\\\hline
+	\CFdelimparam{delimiters} & Définit les délimiteurs. Si ces délimiteurs sont des crochets, il faut écrire \verb|delimiters={[]}|.\\
+	\CFdelimparam{height} & Définit la hauteur (au-dessus du nœud) des délimiteurs.\\
+	\CFdelimparam{depth}  & Définit la profondeur (au-dessous du nœud) des délimiteurs. Si la \chevrons{valeur} est vide, alors la profondeur est égale à la hauteur.\\
+	\CFdelimparam{open xshift}& Définit le décalage horizontal du délimiteur ouvrant.\\
+	\CFdelimparam{close xshift}& Définit le décalage horizontal du délimiteur fermant. Si la \chevrons{valeur} est vide, alors ce décalage devient opposé au décalage du délimiteur ouvrant.\\
+	\CFdelimparam{indice} & Définit l'indice qui sera placé en bas à droite du délimiteur fermant.\\\hline
+\end{tabular}
+\end{center}
+\exemple*{Polymères}|Polyéthylène:
 \chemfig{\vphantom{CH_2}-[@{op,.75}]CH_2-CH_2-[@{cl,0.25}]}
-\makebraces[5pt,5pt]{\!\!n}{op}{cl}
+\polymerdelim[height = 5pt, indice = \!\!n]{op}{cl}
 \bigskip
 
 Polyvinyl chloride:
-\chemfig{\vphantom{CH_2}-[@{op,.75}]CH_2-CH(-[6]Cl)-[@{cl,0.25}]}
-\makebraces[5pt,25pt]{\!\!\!n}{op}{cl}
+\chemfig{\vphantom{CH_2}-[@{op,1}]CH_2-CH(-[6]Cl)-[@{cl,0}]}
+\polymerdelim[height = 5pt, depth = 25pt, open xshift = -10pt, indice = \!\!n]{op}{cl}
 \bigskip
 
 Nylon 6:
 \chemfig{\phantom{N}-[@{op,.75}]{N}(-[2]H)-C(=[2]O)-{(}CH_2{)_5}-[@{cl,0.25}]}
-\makebraces[30pt,5pt]{}{op}{cl}
+\polymerdelim[height = 30pt, depth = 5pt, indice = {}]{op}{cl}
 \bigskip
 
-Polycaprolactame:\setchemfig{atom sep=2em}
+Polycaprolactame:\setchemfig{atom sep = 2em}
 \chemfig{[:-30]-[@{left,.75}]N(-[6]H)-[:30](=[2]O)--[:30]--[:30]--[@{right,0.25}:30]}
-\makebraces[5pt,25pt]{\!\!\!n}{left}{right}
+\polymerdelim[height = 5pt, indice = \!\!n]{left}{right}
 \bigskip
 
-\setpolymerdelim[]
 Polyphénylène sulfide:
 \chemfig{\vphantom{S}-[@{op,.75}]S-(**6(---(-[@{cl,0.25}])---))}
-\makebraces[15pt,15pt]{}{op}{cl}
+\polymerdelim[delimiters = (), height = 15pt, indice = {}]{op}{cl}
 \bigskip
 
 \chemfig{-CH_2-CH([6]-CO-NH-CH_2-NH-CO-CH([4]-CH_2-)([0]-[@{downleft,0.8},2]CH_2
 -CH([2]-CO-NH_2)-[@{downright,0.3},2]CH_2-[,1.5]C?H-))-[@{upleft,0.8},2]CH_2
 -CH([6]-CO-NH_2)-[@{upright,0.3},2]CH_2-[,1.5]CH([6]-CO-NH-CH_2-NH-C?O)-}
-\makebraces[5pt,40pt]{n}{upleft}{upright}
-\makebraces[38pt,7pt]{n}{downleft}{downright}|
+\polymerdelim[delimiters ={[]}, height = 5pt, depth = 40pt, indice = n]{upleft}{upright}
+\polymerdelim[delimiters ={[]}, height = 40pt, depth = 5pt, indice = n]{downleft}{downright}|
 
 \subsection{Dessiner le symétrique d'une molécule}\label{retournement}
 Il existe deux commandes \falseverb{\hflipnext} et \falseverb{\vflipnext} qui permettent de tracer le symétrique de la prochaine molécule par rapport à un axe horizontal ou vertical. Si on souhaite construire le symétrique de plusieurs molécules, il faut écrire les commandes avant chaque molécule concernée.

Modified: trunk/Master/texmf-dist/tex/generic/chemfig/chemfig.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/chemfig/chemfig.tex	2018-11-01 01:23:35 UTC (rev 49042)
+++ trunk/Master/texmf-dist/tex/generic/chemfig/chemfig.tex	2018-11-01 22:08:42 UTC (rev 49043)
@@ -4,9 +4,9 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                                                                    %
 \def\CFname                    {chemfig}                             %
-\def\CFver                      {1.32}                               %
+\def\CFver                       {1.33}                              %
 %                                                                    %
-\def\CFdate                  {2018/08/23}                            %
+\def\CFdate                   {2018/10/31}                           %
 %                                                                    %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
@@ -356,81 +356,77 @@
 \def\redefinesubmol{\CF at definesubmolfalse\def at submol}
 
 \def\def at submol#1{%
-	\begingroup
-		\def\CF at tmp@str{#1}%
-		\catcode`[\@ne\catcode`]\tw@
-		\futurelet\CF at toks@a\CF at test@nxttok
+	\CF at cnt@atomingroup=0 % nombre d'arguments suppos\xE9
+	\def\CF at tmp@str{#1}% nom
+	\futurelet\CF at toks@a\CF at test@nxttok
 }
 
 \def\CF at test@nxttok{%
 	\if[\noexpand\CF at toks@a\expandafter\CF at execfirst\else\expandafter\CF at execsecond\fi
 		{\CF at exp@macroarg\CF at grab@optalias{\CF at tmp@str}}%
-		{\CF at exp@second{%
-			\endgroup
-			\begingroup
-			\CF at sanitize@catcode
-			\def at submol@a
-			}\CF at tmp@str{}%
+		{\afterassignment\CF at test@nxttok at a% pas d'argument entre crochet
+		\CF at cnt@atomingroup=0% cherche le nombre d'arguments \xE9ventuel
 		}%
 }
 
-\def\CF at grab@optalias#1#2{%
-	\endgroup
-	\begingroup
-	\everyeof{\@nil}\endlinechar-1
-	\CF at sanitize@catcode
-	\expandafter\assign at tonil\expandafter\CF at tmp@str\scantokens{#2}%
-	\CF at exp@second{%
-		\CF at sanitize@catcode
-		\def at submol@a{#1}%
-		}\CF at tmp@str
+\def\CF at test@nxttok at a{\futurelet\CF at toks@a\CF at test@nxttok at b}
+
+\def\CF at test@nxttok at b{%
+	\if[\noexpand\CF at toks@a\expandafter\CF at execfirst\else\expandafter\CF at execsecond\fi
+		{\CF at exp@macroarg\CF at grab@optalias{\CF at tmp@str}}
+		{\CF at exp@second{\def at submol@a}\CF at tmp@str{}}%
 }
 
-\def\def at submol@a#1#2#3{% #1 nom, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche
-	\endgroup
-	\ifcat\relax\expandafter\noexpand\CF at firsttonil#1\@nil% si #1 est une s\xE9quence de contr\xF4le
-		\expandafter\ifdefined\CF at firsttonil#1\@nil
+\def\CF at grab@optalias#1[#2]#{\def at submol@a{#1}{#2}}
+
+\def\CF at make@listofargs#1{%
+	\toks\z@{}%
+	\CF at cnt@groupnumber#1\relax
+	\CF at make@listofargs at a1%
+}
+
+\def\CF at make@listofargs at a#1{%
+	\unless\ifnum#1>\CF at cnt@groupnumber
+		\toks\z@\expandafter{\the\toks\z@###1}%
+		\expandafter\CF at make@listofargs at a\expandafter{\number\numexpr#1+1\expandafter}%
+	\fi
+}
+
+\def\def at submol@a#1{% #1 nom
+	\ifcat\relax\expandafter\noexpand\CF at firsttonil#1\@nil\expandafter\CF at execfirst\else\expandafter\CF at execsecond\fi% si #1 est une s\xE9quence de contr\xF4le
+		{\expandafter\ifdefined\CF at firsttonil#1\@nil
 			\ifCF at definesubmol
-				\immediate\write-1{Package \CFname\space Warning: the macro \expandafter\string\CF at firsttonil#1\@nil\space is already defined, the previous definition is lost on input line \the\inputlineno.}%
+				\immediate\write-1{Package \CFname\space Warning: the submol \expandafter\string\CF at firsttonil#1\@nil\space is already defined, the previous definition is lost}%
 			\fi
 		\fi
-		\CF at ifempty{#2}%
-			{\CF at exp@second{\expandafter\def\CF at firsttonil#1\@nil}{\expandafter\empty\romannumeral-`\.\noexpand#3}}
-			{\expandafter\def\CF at firsttonil#1\@nil{%
-				\romannumeral-`\.%
-				\ifdim\CF at current@angle pt>90pt
-					\ifdim\CF at current@angle pt<270pt
-						\expandafter\expandafter\expandafter\CF at execfirst
-					\else
-						\expandafter\expandafter\expandafter\CF at execsecond
-					\fi
-				\else
-					\expandafter\CF at execsecond
-				\fi
-				{\noexpand#2}{\noexpand#3}}%
-			}%
-	\else
-		\ifcsname CF@@#1\endcsname
+		\def at submol@b{#1}%
+		}
+		{\ifcsname CF@@#1\endcsname
 			\ifCF at definesubmol
-				\immediate\write-1{Package \CFname\space Warning:the submol "#1" is already defined, the previous definition is lost on input line \the\inputlineno.}%
+				\immediate\write-1{Package \CFname\space Warning:the submol "#1" is already defined, the previous definition is lost}%
 			\fi
 		\fi
-		\CF at ifempty{#2}%
-			{\CF at exp@second{\expandafter\def\csname CF@@#1\endcsname}{\expandafter\empty\romannumeral-`\.\noexpand#3}}
-			{\expandafter\def\csname CF@@#1\endcsname{%
-				\romannumeral-`\.%
-				\ifdim\CF at current@angle pt>90pt
-					\ifdim\CF at current@angle pt<270pt
-						\expandafter\expandafter\expandafter\CF at execfirst
-					\else
-						\expandafter\expandafter\expandafter\CF at execsecond
-					\fi
+		\expandafter\def at submol@b\csname CF@@#1\endcsname
+		}%
+}
+
+\def\def at submol@b#1#2#3{% #1 nom sous forme de macro, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche, \CF at cnt@atomingroup = nombre d'arguments
+	\CF at make@listofargs\CF at cnt@atomingroup
+	\CF at ifempty{#2}%
+		{\CF at exp@after{\expandafter\def\CF at firsttonil#1\@nil}{\the\toks\z@}{\empty#3}}
+		{\CF at exp@after{\expandafter\def\CF at firsttonil#1\@nil}{\the\toks\z@}{%
+			\romannumeral
+			\ifdim\CF at current@angle pt>90pt
+				\ifdim\CF at current@angle pt<270pt
+					\expandafter\expandafter\expandafter\CF at execfirst
 				\else
-					\expandafter\CF at execsecond
+					\expandafter\expandafter\expandafter\CF at execsecond
 				\fi
-				{\noexpand#2}{\noexpand#3}}%
-			}%
-	\fi
+			\else
+				\expandafter\CF at execsecond
+			\fi
+			{\z@#2}{\z@#3}}%
+		}%
 }
 
 \def\CF at seek@node#1#2#3{% cherche un noeud au d\xE9but de #1 l'assigne dans la sc #2 et met le reste dans #3
@@ -599,16 +595,19 @@
 		{\CF at eexp@second{\def\CF at remain@molecule}{\expandafter\CF at gobarg\CF at remain@molecule}% enl\xE8ve le "!"
 		\CF at ifx\empty\CF at remain@molecule{\errmessage{Package \CFname\space Error: no submol name found after "!"}}{}%
 		\ifcat\relax\CF at three@ea\noexpand\expandafter\CF at firsttonil\CF at remain@molecule*\@nil
-			\CF at eexp@second{\CF at eexp@second{\def\CF at insert@submol}}{\expandafter\CF at firsttonil\CF at remain@molecule\@nil}%
+			\CF at eexp@second{\CF at exp@second{\def\CF at remain@molecule}}{\CF at remain@molecule}%
 		\else
-			\CF at exp@second{\CF at eexp@second{\def\CF at insert@submol}}{\csname CF@@\expandafter\CF at firsttonil\CF at remain@molecule\@nil\endcsname}%
+			\expandafter\CF at seek@submol at a\CF at remain@molecule\@nil
 		\fi
-		\CF at eexp@second{\def\CF at remain@molecule}{\csname CF at insert@submol\CF at three@ea\endcsname\csname @gobble\expandafter\endcsname\CF at remain@molecule}%
 		\CF at seek@submol
 		}%
 		{}%
 }
 
+\def\CF at seek@submol at a#1#2\@nil{% #1=nom
+	\CF at eexp@second{\CF at exp@second{\def\CF at remain@molecule}}{\csname CF@@#1\endcsname#2}%
+}
+
 \def\CF at insert@emptygroup#1{% ins\xE8re {} au d\xE9but de la sc #1
 	\CF at exp@second{\def#1}{\expandafter{\expandafter}#1}%
 }
@@ -970,7 +969,7 @@
 		\or
 			\CF at create@normnodes{#2@@}{#3@@}\CF at double@sep\CF at double@sep
 			\CF at draw@axisbond{#2}{#3}% trace la liaison simple dans l'axe\CF at draw@bond at a(#2@@)--(#3@@);
-			\begingroup% ajuste \xE9ventuellement les longueurs des l(0,0iaisons doubles
+			\begingroup% ajuste \xE9ventuellement les longueurs des liaisons doubles
 				\ifCF at incycle
 					\ifdim\CF at start@offset=\z@
 						\CF at edefadd@tocs\CF at current@bondstyle{,shorten <=\CF at doublebond@lengthcorrection pt}%
@@ -2262,25 +2261,31 @@
 }
 
 \def\CF at grab@delim#1#2#3\@nil{\def\CF at left@delim{#1}\def\CF at right@delim{#2}}
-\def\polymerdelim[#1]#2#3{%
+\def\CF at resetdelim{%
 	\setKVdefault[CFdelimiters]
-		{delimiters   =(),
-		 height       =10pt,
-		 depth        ={},
-		 open xshift  =0pt,
-		 close xshift =0pt,
-		 indice       =n,
-		}%
-	\setKV[CFdelimiters]{#1}%
+		{delimiters  =(),
+		 height      =10pt,
+		 depth       =,
+		 open xshift =0pt,
+		 close xshift=,
+		 indice      =n}%
+}
+\CF at resetdelim
+\def\polymerdelim{\CF at ifnextchar[{\polymerdelim at a}{\polymerdelim at a[]}}
+\def\polymerdelim at a[#1]#2#3{%
+	\CF at resetdelim
+	\CF at doifnotempty{#1}{\setKV[CFdelimiters]{#1}}%
 	\expandafter\expandafter\expandafter\CF at grab@delim\useKV[CFdelimiters]{delimiters}()\@nil
 	\edef\CF at delim@height{\the\dimexpr\useKV[CFdelimiters]{height}}%
 	\CF at eexp@macroarg\CF at ifempty{\useKV[CFdelimiters]{depth}}
 		{\let\CF at delim@depth\CF at delim@height}
-		{\edef\CF at delim@depth{\useKV[CFdelimiters]{depth}}}%
+		{\edef\CF at delim@depth{\the\dimexpr\useKV[CFdelimiters]{depth}}}%
 	\edef\CF at delim@halfdim{\the\dimexpr(\CF at delim@height+\CF at delim@depth)/2}%
 	\edef\CF at delim@vshift {\the\dimexpr(\CF at delim@height-\CF at delim@depth)/2}%
-	\edef\CF at leftdelim@xshift {\the\dimexpr\useKV[CFdelimiters]{open xshift}}%
-	\edef\CF at rightdelim@xshift{\the\dimexpr\useKV[CFdelimiters]{close xshift}}%
+	\edef\CF at leftdelim@xshift{\the\dimexpr\useKV[CFdelimiters]{open xshift}}%
+	\CF at eexp@macroarg\CF at ifempty{\useKV[CFdelimiters]{close xshift}}
+		{\edef\CF at rightdelim@xshift{\the\dimexpr-\useKV[CFdelimiters]{open xshift}}}
+		{\edef\CF at rightdelim@xshift{\the\dimexpr-\useKV[CFdelimiters]{close xshift}}}%
 	\chemmove{%
 		\nulldelimiterspace0pt
 		\pgfextractx\CF at dim{\pgfpointanchor{#2}{center}}\edef\CF at leftdelim@x{\the\CF at dim}%
@@ -2551,4 +2556,9 @@
     ----------------------------------------------------------------------
 v1.32       2018/08/23
     - d\xE9finition de \printatom, \CF at begin@tikzpicture et 
-      \CF at end@tikzpicture dans le fichier t-chemfig.tex
\ No newline at end of file
+      \CF at end@tikzpicture dans le fichier t-chemfig.tex
+          ----------------------------------------------------------------------
+v1.33       2018/10/31
+    - les macros d\xE9finies par \definesubmol peuvent d\xE9sormais avoir un ou
+      plusieurs arguments
+    - macro \polymerdelim document\xE9e
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex	2018-11-01 01:23:35 UTC (rev 49042)
+++ trunk/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex	2018-11-01 22:08:42 UTC (rev 49043)
@@ -1,6 +1,5 @@
 \usemodule[tikz]%
 \input chemfig.tex
-\def\printatom#1{\mathematics{\mathrm#1}}
-\setvalue{CF at begin@tikzpicture}{\starttikzpicture}%
-\setvalue{CF at end@tikzpicture}{\stoptikzpicture}
-\endinput
\ No newline at end of file
+\expandafter\let\csname CF at begin@tikzpicture\endcsname\starttikzpicture
+\expandafter\let\csname CF at end@tikzpicture\endcsname\stoptikzpicture
+\endinput



More information about the tex-live-commits mailing list