我无法弄清楚这一点。我有 3 张小桌子。全部设置使用
\begin{tabular}{|p{.6in}|p{5.5in}|}\hline
所以人们会期望每个表格的宽度都相同,对吧?无论其内容有多宽。我的意思是表格的右边缘应该显示在页面内,即使其内容可以溢出表格右边缘。
在这种情况下,为什么我会得到这个输出:
以下是重现该问题的代码。为了以防万一,我确保至少编译了 3-4 次。
\documentclass[12pt]{book}
\raggedbottom
\usepackage[letterpaper,bindingoffset=0.2in,%
left=0.9in,right=1in,top=1in,bottom=1in,%
footskip=.25in]{geometry}
\usepackage{amsmath}
\usepackage{breqn}
\DeclareMathOperator{\RootOf}{RootOf}
\begin{document}
\begin{minipage}{\textwidth}
\textbf{Problem} 117
\begin{tabular}{|p{.6in}|p{5.5in}|}\hline
ODE&%\vspace{-2em}
\begin{gather*}
\boxed{3 y^{3} x^{2}+y^{4}+\left(3 y^{2} x^{3}+4 x y^{3}+y^{4}\right) y^{\prime}=0}
\end{gather*}
\\ \hline
program solution&
\begin{dmath*}
y \left(x \right) = 0
\end{dmath*}
Verified OK.
\\ \hline
Maple solution&
\begin{dgroup*}
\begin{dmath*}
y \left(x \right) = 0
\end{dmath*}
\begin{dmath*}
x y \left(x \right)^{4}+y \left(x \right)^{3} x^{3}+\frac{y \left(x \right)^{5}}{5}+c_{1} = 0
\end{dmath*}
\end{dgroup*}
\\ \hline
\end{tabular}
\end{minipage}
\normalsize
\begin{minipage}{\textwidth}
\textbf{Problem} 118
\begin{tabular}{|p{.6in}|p{5.5in}|}\hline
ODE&%\vspace{-2em}
\begin{gather*}
\boxed{{\mathrm e}^{x} \sin \left(y\right)+\tan \left(y\right)+\left({\mathrm e}^{x} \cos \left(y\right)+x \left(\sec^{2}\left(y\right)\right)\right) y^{\prime}=0}
\end{gather*}
\\ \hline
program solution&
\begin{dmath*}
{\mathrm e}^{x} \sin \left(y \left(x \right)\right)+x \tan \left(y \left(x \right)\right) = c_{1}
\end{dmath*}
Verified OK.
\\ \hline
Maple solution&
\begin{dmath*}
y \left(x \right) = \arctan \left(-\frac{c_{1} \RootOf \left(\textit{\_Z}^{4} {\mathrm e}^{2 x}+2 x \,{\mathrm e}^{x} \textit{\_Z}^{3}+\left(c_{1}^{2}+x^{2}-{\mathrm e}^{2 x}\right) \textit{\_Z}^{2}-2 x \,{\mathrm e}^{x} \textit{\_Z} -x^{2}\right)}{\RootOf \left(\textit{\_Z}^{4} {\mathrm e}^{2 x}+2 x \,{\mathrm e}^{x} \textit{\_Z}^{3}+\left(c_{1}^{2}+x^{2}-{\mathrm e}^{2 x}\right) \textit{\_Z}^{2}-2 x \,{\mathrm e}^{x} \textit{\_Z} -x^{2}\right) {\mathrm e}^{x}+x}, \RootOf \left(\textit{\_Z}^{4} {\mathrm e}^{2 x}+2 x \,{\mathrm e}^{x} \textit{\_Z}^{3}+\left(c_{1}^{2}+x^{2}-{\mathrm e}^{2 x}\right) \textit{\_Z}^{2}-2 x \,{\mathrm e}^{x} \textit{\_Z} -x^{2}\right)\right)
\end{dmath*}
\\ \hline
\end{tabular}
\end{minipage}
\normalsize
\begin{minipage}{\textwidth}
\textbf{Problem} 119
\begin{tabular}{|p{.6in}|p{5.5in}|}\hline
ODE&%\vspace{-2em}
\begin{gather*}
\boxed{\frac{2 x}{y}-\frac{3 y^{2}}{x^{4}}+\left(-\frac{x^{2}}{y^{2}}+\frac{1}{\sqrt{y}}+\frac{2 y}{x^{3}}\right) y^{\prime}=0}
\end{gather*}
\\ \hline
program solution&
\begin{dmath*}
\frac{x^{2}}{y \left(x \right)}+\frac{y \left(x \right)^{2}}{x^{3}}+2 \sqrt{y \left(x \right)} = c_{1}
\end{dmath*}
Verified OK.
\\ \hline
Maple solution&
\begin{dmath*}
\frac{y \left(x \right)^{2}}{x^{3}}+\frac{x^{2}}{y \left(x \right)}+2 \sqrt{y \left(x \right)}+c_{1} = 0
\end{dmath*}
\\ \hline
\end{tabular}
\end{minipage}
\normalsize
\end{document}
生成的 latex 文件和 pdf 文件,以及我放入其中的日志文件文件夹(安全链接,我自己的网站)。使用路拉泰克斯使用 TL 2022。
我做错了什么吗?每张桌子的右边缘难道不应该完全对齐吗?
是使用上的minipage
问题吗?我想使用来minipage
确保表格上方的行和表格本身保持在同一页上,并且它们之间没有分页符。
答案1
答案2
您可以将问题 118 中的第三个大方程拆分。这要归功于breqn
。然后使用\textstyle
使大分数稍微小一些。
\documentclass[12pt]{book}
\raggedbottom
\usepackage[letterpaper,bindingoffset=0.2in,%
left=0.9in,right=1in,top=1in,bottom=1in,%
footskip=.25in]{geometry}
\usepackage{amsmath}
\usepackage{breqn}
\DeclareMathOperator{\RootOf}{RootOf}
\begin{document}
\begin{minipage}{\textwidth}
\textbf{Problem} 117
\begin{tabular}{|p{.6in}|p{5.5in}|}\hline
ODE&%\vspace{-2em}
\begin{gather*}
\boxed{3 y^{3} x^{2}+y^{4}+\left(3 y^{2} x^{3}+4 x y^{3}+y^{4}\right) y^{\prime}=0}
\end{gather*}
\\ \hline
program solution&
\begin{dmath*}
y \left(x \right) = 0
\end{dmath*}
Verified OK.
\\ \hline
Maple solution&
\begin{dgroup*}
\begin{dmath*}
y \left(x \right) = 0
\end{dmath*}
\begin{dmath*}
x y \left(x \right)^{4}+y \left(x \right)^{3} x^{3}+\frac{y \left(x \right)^{5}}{5}+c_{1} = 0
\end{dmath*}
\end{dgroup*}
\\ \hline
\end{tabular}
\end{minipage}
\normalsize
\begin{minipage}{\textwidth}
\textbf{Problem} 118
\begin{tabular}{|p{.6in}|p{5.5in}|}\hline
ODE&%\vspace{-2em}
\begin{gather*}
\boxed{{\mathrm e}^{x} \sin \left(y\right)+\tan \left(y\right)+\left({\mathrm e}^{x} \cos \left(y\right)+x \left(\sec^{2}\left(y\right)\right)\right) y^{\prime}=0}
\end{gather*}
\\ \hline
program solution&
\begin{dmath*}
{\mathrm e}^{x} \sin \left(y \left(x \right)\right)+x \tan \left(y \left(x \right)\right) = c_{1}
\end{dmath*}
Verified OK.
\\ \hline
Maple solution&
\begin{dmath*}\textstyle
y \left(x \right) = \arctan \left(-\frac{c_{1} \RootOf \left(\textit{\_Z}^{4} {\mathrm e}^{2 x}+2 x \,{\mathrm e}^{x} \textit{\_Z}^{3}+\left(c_{1}^{2}+x^{2}-{\mathrm e}^{2 x}\right) \textit{\_Z}^{2}-2 x \,{\mathrm e}^{x} \textit{\_Z} -x^{2}\right)}{\RootOf \left(\textit{\_Z}^{4} {\mathrm e}^{2 x}+2 x \,{\mathrm e}^{x} \textit{\_Z}^{3}+\left(c_{1}^{2}+x^{2}-{\mathrm e}^{2 x}\right) \textit{\_Z}^{2}-2 x \,{\mathrm e}^{x} \textit{\_Z} -x^{2}\right) {\mathrm e}^{x}+x},\\ \RootOf \left(\textit{\_Z}^{4} {\mathrm e}^{2 x}+2 x \,{\mathrm e}^{x} \textit{\_Z}^{3}+\left(c_{1}^{2}+x^{2}-{\mathrm e}^{2 x}\right) \textit{\_Z}^{2}-2 x \,{\mathrm e}^{x} \textit{\_Z} -x^{2}\right)\right)
\end{dmath*}
\\ \hline
\end{tabular}
\end{minipage}
\normalsize
\begin{minipage}{\textwidth}
\textbf{Problem} 119
\begin{tabular}{|p{.6in}|p{5.5in}|}\hline
ODE&%\vspace{-2em}
\begin{gather*}
\boxed{\frac{2 x}{y}-\frac{3 y^{2}}{x^{4}}+\left(-\frac{x^{2}}{y^{2}}+\frac{1}{\sqrt{y}}+\frac{2 y}{x^{3}}\right) y^{\prime}=0}
\end{gather*}
\\ \hline
program solution&
\begin{dmath*}
\frac{x^{2}}{y \left(x \right)}+\frac{y \left(x \right)^{2}}{x^{3}}+2 \sqrt{y \left(x \right)} = c_{1}
\end{dmath*}
Verified OK.
\\ \hline
Maple solution&
\begin{dmath*}
\frac{y \left(x \right)^{2}}{x^{3}}+\frac{x^{2}}{y \left(x \right)}+2 \sqrt{y \left(x \right)}+c_{1} = 0
\end{dmath*}
\\ \hline
\end{tabular}
\end{minipage}
\normalsize
\end{document}
答案3
显然,包中的宏
breqn
不能p{width}
像您预期的那样在带有列的表中起作用。一种可能的解决方案是不使用它,而是在需要时使用
amsmath
数学环境( ,aligned`,...)在更多行中手动分解方程式。 - 对于较短的代码,我会gather
- 定义新运算符
\e
, - 用于编写“问题”的新命令,
- 当方程式需要较小的字体时,使用(˙amsmath` 包的扩展)
\medmath
中定义的。nccmath
- 定义新运算符
梅威瑟:
\documentclass[12pt]{book}
\raggedbottom
\usepackage[letterpaper,bindingoffset=0.2in,%
left=0.9in,right=1in,top=1in,bottom=1in,%
footskip=.25in]{geometry}
\usepackage{nccmath}
\DeclareMathOperator{\e}{\mathrm{e}}
\DeclareMathOperator{\RootOf}{RootOf}
%\usepackage{breqn}
\newcommand\problem[1]{\par
\bigskip\textbf{Problem}~#1\par
\medskip}
\begin{document}
\problem{117}
\begin{tabular}{|p{0.6in}|p{5.5in}|}
\hline
ODE & \[
\boxed{3 y^{3} x^{2}+y^{4} + (3 y^{2}x^{3} + 4 xy^{3} + y^{4}t) y^{\prime}=0}
\] \\
\hline
program solution
& \[
y(x) = 0
\]
Verified OK. \\
\hline
Maple solution
& \[\begin{aligned}
y(x) & = 0 \\
xy(x)^{4} + y(x)^{3} x^{3} + \frac{y(x)^{5}}{5} + c_{1}
& = 0
\end{aligned}\] \\
\hline
\end{tabular}
\problem{118}
\begin{tabular}{|p{0.6in}|p{5.5in}|}
\hline
ODE & \begin{gather*}
\boxed{{\mathrm e}^{x} \sin \left(y\right)+\tan \left(y\right)+\left({\mathrm e}^{x} \cos \left(y\right)+x \left(\sec^{2}\left(y\right)\right)\right) y^{\prime}=0}
\end{gather*} \\
\hline
program solution
& \[
\mathrm{e}^{x} \sin \left(y \left(x \right)\right) + x \tan \left(y \left(x \right)\right) = c_{1}
\]
Verified OK. \\
\hline
Maple solution
& \[\medmath{
\begin{aligned}
y(x) & = \arctan \biggl(
-\frac{c_{1} \RootOf\bigl(\_Z^{4} \e^{2 x}+2 x \,\e^{x} \_Z^{3} + (c_{1}^{2}+x^{2}-\e^{2 x}) \_Z^{2}-2 x \,\e^{x} \_Z -x^{2}\bigr)}
{\RootOf\bigl(\_Z^{4} \e^{2 x}+2 x \e^{x} \_Z^{3} + (c_{1}^{2}+x^{2} - \e^{2 x}) \_Z^{2} - 2 x \e^{x} \_Z - x^{2}\bigr) \e^{x} + x}, \\
&\quad \RootOf\bigl(\_Z^{4} \e^{2 x}+2 x \,\e^{x} \_Z^{3} + (c_{1}^{2}+x^{2}-\e^{2 x} ) \_Z^{2}-2 x \,\e^{x} \_Z -x^{2}\bigr)
\biggr)
\end{aligned}}\] \\
\hline
\end{tabular}
\end{document}
- 上述主张需要更多的工作,但你将获得漂亮的表格: