So with this code using xparse :

\NewDocumentEnvironment{figwcommentary}{O{0.45} m m}
{ \adjustbox{valign=t} {\begin{minipage}{#1\textwidth} #2 \end{minipage} } }
{ \adjustbox{valign=t,right=0.5\textwidth}{ #3 } \bigskip}

That right=0.5\textwidth} should be right=(1-#1-.05)*\textwidth} which of course isn't valid code.

It looks like calc or fp can be used for this, but I can't figure out how to reference the passed parameter.

  • 2
    Could you post a compilable code, not just a snippet? – Bernard Aug 12 '20 at 18:57
  • It's quite hard to understand what your code is supposed to do. – egreg Aug 12 '20 at 22:00

Not as hard as I thought :

\NewDocumentEnvironment{figwcommentary}{O{0.45} m m}
\adjustbox{valign=t} {\begin{minipage}{#1\textwidth} #2 \end{minipage} } }
{ \adjustbox{valign=t,right=\adjustedlen\textwidth}{ #3 } \bigskip}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.