특별한 "또는" 환경을 만드는 방법은 무엇입니까?

특별한 "또는" 환경을 만드는 방법은 무엇입니까?

왼쪽에 수직선이 만들어지고 줄 바꿈마다 자동으로 "or"가 삽입되는 환경을 만들고 싶습니다. 그 목적은 수학적인 맥락에 있을 것입니다.

다음과 같이 보일 것입니다 :

모델

답변1

tcolorbox패키지를 사용하여 수직선을 생성하는 환경을 만들 수 있습니다 .

\documentclass[a4paper]{article}
\usepackage[most]{tcolorbox}
% \usepackage{pgfplots}


\newtcolorbox{env}{
        enhanced,
        breakable, % This make the box breakable
        boxrule=0pt,
        frame hidden,
        borderline west={2pt}{0pt}{black}, % this create the line
        colback=white, % The background color,
        math upper,
        hbox,
        center
    }

\begin{document}
 Text text text
    \begin{env}
        \int_{-\infty}^{\infty}f(x)\delta(x-a)dx = f(a)
    \end{env}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

배열과 같은 환경을 사용하고또는첫 번째 요소가 아닌 모든 요소 앞에는 매우 깨끗하지는 않지만 작동합니다.

    \documentclass[a4paper]{article}

    \usepackage{ifthen}
    \newcounter{orcounter}

    \newenvironment{orlist}{%
      \noindent\begin{tabular*}{\textwidth}{|l}
      \setcounter{orcounter}{0}
    }{%
     \end{tabular*}
    }

    \newcommand{\oritem}[1]{%
      \ifthenelse{\equal{\theorcounter}{0}}{\hspace{-1em}}{\\ \textbf{or}\\}
      #1\stepcounter{orcounter}
    }

    % -- Usage Example
    \begin{document}

    \begin{orlist}
      \oritem{example 1}
      \oritem{example 2}
    \end{orlist}

    \end{document}

답변3

나는 스스로 해결책을 찾았습니다.

\documentclass[a4paper]{article}

\newenvironment{ouenv}
{\left\lvert\begin{array}{l}}
{\end{array}\right.}

\begin{document}
\[\begin{ouenv}G\text{ abélien} \\ \text{ou} \\ I=\ensvide\end{ouenv}\]
\end{document}

다음과 같은 결과를 제공합니다.

결과

(텍스트는 프랑스어로 되어 있지만 상관없습니다.)

답변4

같은 반 친구의 도움으로 제가 원래 원했던 것과 훨씬 더 유사한 새로운 솔루션을 만들 수 있었습니다. 환경 대신 명령을 사용하지만 훨씬 좋습니다!

코드는 다음과 같습니다.

\newcounter{orcounter}

\newenvironment{orlist}
{
\begin{array}{|l}
\setcounter{orcounter}{0}
}
{
\end{array}
}

\newcommand{\oritem}[1]{%
\ifthenelse{\theorcounter<1}{}{\\ \text{ou} \\}#1\stepcounter{orcounter}
}

\NewDocumentCommand{\orenv}{>{\SplitList{\\}}m}{%
\begin{orlist}\ProcessList{#1}{\oritem}\end{orlist}}

다음과 같이 매우 간단하게 사용할 수 있습니다.

\[\orenv{G\text{ abélien} \\ I=\ensvide}\]

관련 정보