왜 때때로 테이블 너비가 준수되지 않습니까?

왜 때때로 테이블 너비가 준수되지 않습니까?

나는 이것을 이해할 수 없다. 작은 테이블이 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}

생성된 라텍스 파일과 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에서 세 번째 큰 방정식을 분할할 수 있습니다. 이는 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수학 환경( , alignment`, ...)을 사용하여 수동으로 방정식을 더 많은 줄로 나누는 것입니다. 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}
  • 위의 제안에는 좀 더 많은 작업이 필요하지만 보기 좋은 테이블이 제공됩니다.

여기에 이미지 설명을 입력하세요

관련 정보