I'm trying to create a a bipartite object that has the \textwidth
at most, and doesn't overflow from the right, but has the width of the separator given as an argument.
I attempted to achieve this by scaling the left side with the first optional argument and then subtracting the same amount from the right. Problem is, this doesn't compile. The error message vaguely mentions that \relax
is expecting a number, but I don't understand why doesn't it work.
\newcommand{\bipart}[3][0.06]
{
\noindent
\begin{minipage}[h]{#1\textwidth} %fine
#2
\end{minipage}
\vrule \hspace{0.15in}
\begin{minipage}[h]{(0.85-#1)\textwidth} %fails
#3
\end{minipage}
\vspace{0.15in}
\normalsize
}
A workaround would be to add another optional argument and always do the computation myself, however I don't like that, among other things, because I would need to renumber the arguments.
\the\dimexpr0.85\textwidth-#1\textwidth
instead of(0.85-#1)\textwidth
. (I do however not see how a default value of3
makes sense, 0.85-3 is very negative.)calc
package. You are inserting word spaces in several places which you are not taking account of in the calculation , after the{
after the\hspace
after both of theend{minipage}
[h]
option, the fact that it does not raise an error is just due to the memory limitations when that was implemented, it is just silently ignored\textwidth
) or<factor><unit of measure>
, where<unit of measure>
itself can be either a decimal constant (like1 pt
) or an internal dimen. Nowhere in this process TeX expects parenthesis or floating point calculations. The first one works because#1
is the<factor>
.