なぜテーブルの幅が守られないことがあるのでしょうか?

なぜテーブルの幅が守られないことがあるのでしょうか?

これはわかりません。小さなテーブルが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

問題のある表形式が非常に大きいためdmath、この場合はdmathparbox を幅に合わせて強制します\columnwidth(breqn は、実際にはボックスと表形式の計算を想定していないと思います)。

使用

\usepackage{array}
....
\begin{tabular}{|p{.6in}|>{\setlength\columnwidth{5.5in}}p{5.5in}|}\hline

すると、式は依然として溢れてしまいますが(ブレークポイントがないので)、右側は\hline 正しい位置になります。

ここに画像の説明を入力してください

答え2

問題 118 の 3 番目の大きな方程式を分割することができます。これは のおかげで可能になります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}期待どおりに機能しないようです。

  • 1つの解決策としては、これを使用せず、必要に応じてamsmath数式環境( 、aligned`、...)を使用して手動で式を分割することです。 - コードを短くするには、gather

    • 新しい演算子を定義します\e
    • 「問題」を書き込むための新しいコマンド、
    • 数式で小さいフォントが必要な場合は、 (˙amsmath` パッケージの拡張)\medmathで定義されているものを使用します。nccmath
  • MWE:

\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}
  • 上記の提案にはもう少し作業が必要ですが、見栄えの良いテーブルが作成されます。

ここに画像の説明を入力してください

関連情報