
Ich kann das nicht verstehen. Ich habe 3 kleine Tische. Alle eingerichtet mit
\begin{tabular}{|p{.6in}|p{5.5in}|}\hline
Man würde also erwarten, dass jede Tabelle die gleiche Breite hat, oder? Unabhängig davon, wie breit ihr Inhalt ist. Ich meine, die rechte Kante der Tabelle sollte innerhalb der Seite angezeigt werden, auch wenn ihr Inhalt über die rechte Kante der Tabelle hinausragen kann.
Warum erhalte ich in diesem Fall diese Ausgabe:
Hier ist der Code zur Reproduktion. Ich habe vorsichtshalber auch darauf geachtet, mindestens 3-4 Mal zu kompilieren.
\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}
Die Latex-Datei und die PDF-Datei generiert, und die Protokolldatei habe ich in diesemOrdner(sicherer Link, meine eigene Site). MitLualatexmit TL 2022.
Mache ich etwas falsch? Müsste nicht bei jeder Tabelle die rechte Kante exakt ausgerichtet sein?
Ist die Verwendung minipage
das Problem? Ich möchte sicherstellen, minipage
dass die Zeile über der Tabelle und die Tabelle selbst auf derselben Seite bleiben und kein Seitenumbruch dazwischen auftritt.
Antwort1
Sie haben eine sehr große Zahl dmath
in der problematischen Tabelle, und in diesem Fall dmath
wird die Parbox auf die Breite gezwungen \columnwidth
(breqn erwartet meiner Meinung nach nicht wirklich, dass die Mathematik in Boxen und Tabellen erfolgt).
Verwenden
\usepackage{array}
....
\begin{tabular}{|p{.6in}|>{\setlength\columnwidth{5.5in}}p{5.5in}|}\hline
Dann läuft die Gleichung zwar immer noch über (da es keinen Haltepunkt gibt), aber das Richtige \hline
steht an der richtigen Stelle:
Antwort2
Sie können die dritte große Gleichung in Aufgabe 118 aufteilen. Dies ist dank möglich breqn
. Und verwenden Sie dann \textstyle
, um den großen Bruch etwas kleiner zu machen.
\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}
Antwort3
Offenbar
breqn
funktionieren Makros aus dem Paket in Tabellen mitp{width}
Spalten nicht wie erwartet.Eine mögliche Lösung besteht darin, es nicht zu verwenden und Gleichungen bei Bedarf manuell mithilfe von
amsmath
mathematischen Umgebungen ( , aligniert`, ...) in mehrere Zeilen aufzuteilen. -Für kürzeren Code würde ichgather
- neuen Operator definieren
\e
, - neuer Befehl zum Schreiben von "Problem",
- Verwenden Sie
\medmath
die innccmath
(Erweiterung des Pakets „amsmath“) definierte Option, wenn eine kleinere Schriftart in der Gleichung erforderlich ist.
- neuen Operator definieren
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}
- Der obige Vorschlag erfordert etwas mehr Arbeit, wird aber mit gut aussehenden Tabellen belohnt: