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}
2
  • why have you #4 here it is B in the first case and \par (an error) in teh second Nov 30, 2015 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, 2015 at 8:48

1 Answer 1

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}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .