¿Por qué a veces no se respeta el ancho de la mesa?

¿Por qué a veces no se respeta el ancho de la mesa?

No puedo entender este. Tengo 3 mesas pequeñas. Todo listo usando

\begin{tabular}{|p{.6in}|p{5.5in}|}\hline

Entonces uno esperaría que cada mesa tuviera el mismo ancho, ¿verdad? independientemente de cuán amplio sea su contenido. Quiero decir que el borde derecho de la tabla debería aparecer dentro de la página, incluso si su contenido puede extenderse fuera del borde derecho de la tabla.

En este caso, ¿por qué obtengo este resultado?

ingrese la descripción de la imagen aquí

Aquí está el código para reproducirlo. También me aseguré de compilar al menos 3 o 4 veces por si acaso.

\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}

El archivo latex y el archivo pdf generado, y el archivo de registro que puse en estecarpeta(enlace seguro, mi propio sitio). Usandolualatexcon TL 2022.

¿Estoy haciendo algo mal? ¿No debería estar alineado exactamente el borde derecho de las mesas para cada mesa?

¿Es el uso del minipageproblema? Quiero usarlo minipagepara asegurarme de que la línea sobre la tabla y la tabla misma permanezcan en la misma página y no tengan saltos de página entre ellas.

Respuesta1

Tiene un dmathtabular muy grande en el problema, y ​​en este caso dmathforzará el parbox al ancho \columnwidth(breqn realmente no espera que las matemáticas estén en cuadros y tabulares en mi humilde opinión).

Usar

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

Entonces la ecuación seguirá desbordándose (ya que no hay punto de interrupción) pero lo correcto \hline estará en el lugar correcto:

ingrese la descripción de la imagen aquí

Respuesta2

Puedes dividir la tercera ecuación grande del problema 118. Esto es posible gracias a breqn. Y luego úsalo \textstylepara hacer la fracción grande un poco más pequeña.

\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}

ingrese la descripción de la imagen aquí

Respuesta3

  • Aparentemente, las macros del breqnpaquete no funcionan en la tabla con p{width}columnas como esperaba.

  • Una posible solución es no usarlo y dividir manualmente la ecuación usando amsmathentornos matemáticos ( gather, alineado`, ...) en más líneas cuando sea necesario. -Para un código más corto lo haría

    • definir nuevo operador \e,
    • nuevo comando para escribir "problema",
    • use \medmathdefinido en nccmath(que es una extensión del paquete ˙amsmath`) cuando se necesite una fuente más pequeña en la ecuación.
  • 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}
  • La propuesta anterior requiere un poco más de trabajo, pero se le otorgarán tablas bonitas:

ingrese la descripción de la imagen aquí

información relacionada