答案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
答案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}\]