1

Why jumping a line cause a problem here ?

\documentclass{article}
\usepackage{multicol,xparse}

\NewDocumentEnvironment{DeuxCols}
    {
    D<>{30pt}
    O{.5pt}
    mm
    }{%
    \setlength{\multicolsep}{0pt}%
    \setlength{\columnsep}{#1}%
    \setlength{\columnseprule}{#2}%
    \begin{multicols}{#3}%
    #4}{%
    \end{multicols}%
    \addvspace{2pt}}

\begin{document}

\begin{DeuxCols}{2} % works
Bla
\end{DeuxCols}

\begin{DeuxCols}{2} % doesn't work

Bla
\end{DeuxCols}

\end{document}
  • why have you #4 here it is B in the first case and \par (an error) in teh second – David Carlisle Nov 30 '15 at 8:07
  • Ok I misunderstood how newenvironment works. I thaught that #4 is the material to pass in the multicol environment. Thank you. Fill free to write an answer. – Tarass Nov 30 '15 at 8:48
2

You do not need #4 here it is just picking up the first token of the environment B in the first case and \par (which gives the error) in the second.

\NewDocumentEnvironment{DeuxCols}
    {
    D<>{30pt}
    O{.5pt}
    m
    }{%
    \setlength{\multicolsep}{0pt}%
    \setlength{\columnsep}{#1}%
    \setlength{\columnseprule}{#2}%
    \begin{multicols}{#3}%
    }{%
    \end{multicols}%
    \addvspace{2pt}}

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.