我有文本、公式和枚举。我尝试使用multicols
,但它会将文本划分到所需的位置。我使用了tabular
,但它不允许枚举,或者我不知道该怎么做。换句话说,我想将页面的某些部分分成两部分,如图所示:
我还想保存一个枚举。另请参阅页面第二部分的边框和对齐方式。如何在 LaTeX 中执行此操作?
答案1
您可以使用minipage
和 来实现这一点tabular
。但这种方法不会影响整个页面。
\documentclass{article}
\begin{document}
\begin{minipage}{0.45\textwidth}
\begin{enumerate}
\item First item \\
This is the second line in item and this may extend to third if long
\item second item\ldots
\end{enumerate}
\end{minipage}%
\hfill
\begin{minipage}{0.45\textwidth}
\begin{tabular}{|p{\textwidth}}
This is second part \\
$f(x) = 2x + 3y$ This line may go all along the end and wrap afterwards to the next as seen here\\
This is a forced next line by ending the previous line
\end{tabular}
\end{minipage}%
\end{document}
看来另一种可能性是使用parallel
包裹。
\documentclass{article}
\usepackage{parallel,enumitem}
\begin{document}
\noindent
Here we use \texttt{parallel} package.
\par
\begin{Parallel}[v]{0.48\textwidth}{0.48\textwidth}
\ParallelLText{\noindent
This is the left side.
\begin{enumerate}[itemsep=1ex,leftmargin=1cm,rightmargin=.52\textwidth]
\item { First item}
\item{second item}
\end{enumerate}
And you are back in business.\\
This list can break across pages automatically }
\ParallelRText{\noindent
This goes to the right. This may be going long. If you want you can input equations also.\\
$x=y+10$\\
This may be the best choice if you want this kind of thing to span multiple pages. }
\ParallelPar
\end{Parallel}
\end{document}
答案2
如果您想使用multicols
,然后在您想要的地方划分页面。您可以使用\columnbreak
来实现这一点。
下面是一个完整的示例,演示了如何实现这一点(改编自完整的此处为背面示例):
\documentclass{article}
\usepackage{blindtext}
\usepackage{multicol}
\usepackage{color}
\usepackage{xcolor}
\setlength{\columnseprule}{1pt}
\def\columnseprulecolor{\color{black}}
\begin{document}
\begin{multicols}{2}
Hello, here is some text without a meaning. This text should show what
a printed text will look like at this place.
\begin{enumerate}
\item { First item}
\item{second item}
\end{enumerate}
If you want to move to the next column of your choice then do so here.
\columnbreak
This will be in a new column, here is some text without a meaning. This text
should show what a printed text will look like at this place.
If you read this text, you will get no information. Really? Is there
no information? Is there...
\end{multicols}
\end{document}
编译文档的可视化
注意,为了实现页面分割,\def\columnseprulecolor{\color{black}}
在示例顶部设置了颜色,这里我使用了黑色,但可以设置为其他颜色,比如蓝色 - 有关详细信息,请参阅Overleaf 颜色文档。
作为参考,我使用 Overleaf 生成了这个示例。