구분 기호 문제 없이 paracol에서 LaTeX3 환경을 만드는 방법은 무엇입니까?

구분 기호 문제 없이 paracol에서 LaTeX3 환경을 만드는 방법은 무엇입니까?

이거 돌리고 싶다답변환경에. 그래서 xparseLaTeX3 환경을 정의하는데 사용하는데 오류가 발생해서 조금 아쉬운 부분이 있습니다.

구분 기호 및 환경 종료에 문제가 있는 것 같습니다.

여기 MWE는 다음과 같습니다.

\documentclass{article}

  \usepackage{graphicx,float}
  \usepackage{amsmath}
  \usepackage{paracol}
     \setlength{\columnseprule}{0.4pt}
     \setlength{\columnsep}{2em}

  \usepackage{xparse}
     \ExplSyntaxOn
     \NewDocumentEnvironment{outParaCol}{+b}
     {
        \group_begin:
        \switchcolumn[0]*[#1]
     }
     {
        \group_end:
     }
     \ExplSyntaxOff


\begin{document} 

\begin{paracol}{2}
  \begin{leftcolumn}
     For several days in succession fragments of a defeated army had passed through the town. 
     
     They were mere disorganized bands, not disciplined forces. 
     The men wore long, dirty beards and tattered uniforms; they advanced in listless fashion, without a flag, without a leader.
     All seemed exhausted, worn out, incapable of thought or resolve, marching onward merely by force of habit, and dropping to the ground with fatigue the moment they halted.
  \end{leftcolumn}
  \begin{rightcolumn}
     Pendant plusieurs jours de suite des lambeaux d'armée en déroute avaient traversé la ville. 

     Ce n'était point de la troupe, mais des hordes débandées. 
     Les hommes avaient la barbe longue et sale, des uniformes en guenilles, et ils avançaient d'une allure molle, 
     sans drapeau, sans régiment. Tous semblaient accablés, éreintés, incapables d'une pensée ou d'une résolution,   marchant seulement par habitude, et tombant de fatigue sitôt qu'ils s'arrêtaient. 
  \end{rightcolumn}

  \begin{outParaCol} % not working %  Missing delimiter (. inserted). <to be read again> \tex_par:D 
  % \switchcolumn[0]*[{ % working
     \begin{equation}
           a+B \left[\frac{1}{2}\right]
     \end{equation}
  % }] % end of switchcolumn
  \end{outParaCol}

  \begin{outParaCol} % not working % Paragraph ended before \@float@HH was complete. <to be read again> \par 
  % \switchcolumn[0]*[{ % working
     \begin{figure}[H]
     \centering
     \includegraphics[width=\linewidth]{example-image}
     \setlength{\columnwidth}{\dimexpr 0.5\textwidth-0.5\columnsep}%
        \caption{A caption}
     \end{figure}
  %  }] % end of switchcolumn
  \end{outParaCol}

  \begin{leftcolumn}
     One saw, in particular, many enlisted men, pea\-ceful citizens, men who lived quietly on their income, bending beneath the weight of their rifles; and little active volunteers,   easily frightened but full of enthusiasm, as eager to attack as they were ready to take to flight; and amid these, a sprinkling of red-breeched soldiers,       the pitiful remnant of a division cut down in a great battle; somber artillerymen, side by side with nondescript foot-soldiers; and, here and there, the gleaming helmet of a heavy-footed dragoon who had difficulty in keeping up with the quicker pace of the soldiers of the line.
  \end{leftcolumn}
  \begin{rightcolumn}
     On voyait surtout des mobilisés, gens pacifiques, rentiers tranquilles, pliant sous le poids du fusil; des petits moblots alertes, faciles à l'épouvante et prom\-pts à l'enthousiasme, prêts à l'attaque comme à la fuite; puis, au milieu d'eux, quelques culottes rouges, débris d'une division moulue dans une gran\-de bataille; des artilleurs sombres alignés avec des fantassins divers; et, parfois, le casque brillant d'un dragon au pied pesant qui suivait avec peine la marche plus légère des lignards.
  \end{rightcolumn}

\end{paracol}
\end{document}
%EoF

답변1

xparse오래된 라텍스 릴리스에만 필요합니다 .

\NewDocumentEnvironmentltcmd.dtxLaTeX 형식의 일부로 정의되어 있으며 패키지 없이도 사용할 수 있습니다.

문제는 참조된 코드에서 인수 {}에 사용된 을 생략했다는 것입니다 .[{...}]

여기서는 {}인수를 구분합니다( ]필요한 경우 선택적 인수가 끝나도록 중첩된 항목을 숨김). 그러한 용도로 \bgroup암시 적 그룹을 사용할 수 없습니다 . 당신 이 \group_begin:필요로하는 것처럼 당신은 사용할 수 없습니다 .{}\fbox{abc}\fbox\bgroup abc\egroup

관련 정보