文本超出了列,我该如何修复?我需要它flalign
,我们最好不要把它拿出来。
\documentclass{article}
\usepackage[paperwidth=19.0cm,paperheight=27.5cm,margin=1.5cm]{geometry}
\usepackage{amsmath}
\usepackage{multicol,enumitem}
\setlength{\columnseprule}{1.7pt}
\setlength{\columnsep}{1.2cm}
\begin{document}
\begin{multicols*}{2}
\begin{enumerate}[left=0pt,label=\bfseries\arabic*.,ref=\arabic*]
\item No problem here. Text does not exceed the column.
\begin{flalign*}
&x^2+y^2 \text{But here the text exceeds the column. How can I solve the problem here?}&
\end{flalign*}
\end{enumerate}
\end{multicols*}
\end{document}
答案1
\text
本质上\mbox
不允许换行。通常最好避免在数学中放置段落级文本,但如果必须,您可以使用\parbox
\documentclass{article}
\usepackage[paperwidth=19.0cm,paperheight=27.5cm,margin=1.5cm]{geometry}
\usepackage{amsmath}
\usepackage{multicol,enumitem}
\setlength{\columnseprule}{1.7pt}
\setlength{\columnsep}{1.2cm}
\begin{document}
\begin{multicols*}{2}
\begin{enumerate}[left=0pt,label=\bfseries\arabic*.,ref=\arabic*]
\item No problem here. Text does not exceed the column.
\begin{flalign*}
&x^2+y^2 \quad \parbox[t]{4cm}{But here the text exceeds the column. How can I solve the problem here?}&
\end{flalign*}
\end{enumerate}
\end{multicols*}
\end{document}
flalign*
在这个小例子中肯定被误用了,但也许你的真实文档在有意义的地方有一些对齐。
答案2
使用 tabularx 可以达到同样的效果。
\documentclass{article}
\usepackage[paperwidth=19.0cm,paperheight=27.5cm,margin=1.5cm]{geometry}
\usepackage{amsmath}
\usepackage{multicol,enumitem}
\setlength{\columnseprule}{1.7pt}
\setlength{\columnsep}{1.2cm}
\usepackage{tabularx}
\begin{document}
\begin{multicols*}{2}
\begin{enumerate}[left=0pt,label=\bfseries\arabic*.,ref=\arabic*]
\item No problem here. Text does not exceed the column.
\begin{tabularx}{\linewidth}{@{}cX@{}}
$x^2+y^2$ &
But here the text exceeds the column. How can I solve the problem here?
\end{tabularx}
\end{enumerate}
\end{multicols*}
\end{document}