I am trying to write an environment which provides (some of) the functionality parallel environment through tabular syntax so that the following two code snippets would give equivalent results:
\begin{Parallel}{4cm}{5cm}
\ParallelLText{TEXT 1}
\ParallelRText{TEXT 2}
\end{ParallelWithTabularSyntax}
(usual syntax above)
\begin{ParallelWithTabularSyntax}{p{4cm}p{5cm}}
TEXT 1 & TEXT 2
\end{ParallelWithTabularSyntax}
So far, I've got the following code, which works:
\NewEnviron{ParallelWithTabularSyntax}[1]{%
\StrFindGroup{#1}{1}[\dimL]
\StrFindGroup{#1}{2}[\dimR]
\def \textL {\StrBefore{\BODY}{&}}
\def \textR {\StrBehind{\BODY}{&}}
\begin{Parallel}{0.5\textwidth}{0.5\textwidth}
\ParallelLText{\textL}
\ParallelRText{\textR}
\end{Parallel}
}
However, I would like two write the code below to use the arguments given by the user, but this gives the error ! Missing number, treated as zero. I guess the cause for this is that the digits in the string \textL is threated as letters and not as digits. How do you make LaTeX/TeX treat the digits as digits?
\NewEnviron{ParallelWithTabularSyntax}[1]{%
\StrFindGroup{#1}{1}[\dimL]
\StrFindGroup{#1}{2}[\dimR]
\def \textL {\StrBefore{\BODY}{&}}
\def \textR {\StrBehind{\BODY}{&}}
\begin{Parallel}{\dimL}{\dimR}
\ParallelLText{\textL} % Problematic rows
\ParallelRText{\textR} % ----------------
\end{Parallel}
}
\StrBeforeisn't an expandable command so it is a sequence of\defand other instructions that would typeset as digits if typesetting but can not be used in an assignment, like\setlength\foo{\def\zz{1pt}\zz}does not work to set\footo1pt– David Carlisle Jun 20 '13 at 12:58