ปัญหาแปลก ๆ โดยใช้แนวนอนหลังหน้าและแยก

Aug 18 2020

ฉันมีปัญหาใน Latex โดยที่ \ afterpage ดูเหมือนว่าจะมีปัญหากับสมการการแบ่งดังนั้นโค้ดจึงไม่คอมไพล์ ฉันใช้ \ afterpage เพื่อเติมเต็มหน้าก่อนที่จะนำเสนอภาพแนวนอนขนาดใหญ่เพื่อหลีกเลี่ยงช่องว่างที่สร้างขึ้นเป็นอย่างอื่น นี่คือ MWE (แสดงความคิดเห็นในคำสั่ง \ afterpage และจะคอมไพล์):

\documentclass[a4paper]{scrbook}
\usepackage{amsmath, amssymb}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{lipsum}


\begin{document}
\lipsum[1-2][1-20]
\afterpage{
\begin{landscape}
\begin{figure}
\includegraphics[width=\textwidth]{example-image-a}
\caption{Caption}
\end{figure}
\end{landscape}}
\lipsum[1-5]
\begin{equation}
\begin{split}
x&=\frac{\pi}{2}\\
&=\frac{3}{2}
\end{split}
\end{equation}
\lipsum[1-2]
\end{document}

คำตอบ

1 JohnKormylo Aug 18 2020 at 21:45

วิธีแก้ปัญหาง่ายๆคือแยกสมการออกจากย่อหน้าก่อนหน้า วิธีแก้ปัญหานี้ทำให้สมการอยู่ในย่อหน้าที่แยกกันได้ แต่ระยะห่างของบรรทัดแรกและบรรทัดสุดท้ายจะคลาดเคลื่อนเล็กน้อย

\documentclass[a4paper]{scrbook}
\usepackage{amsmath, amssymb}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{lipsum}

\newsavebox{\tempbox}

\begin{document}
\lipsum[1-2]
\afterpage{%
\begin{landscape}
\begin{figure}
\centering
\includegraphics[width=\textheight]{example-image-a}
\caption{Caption}
\end{figure}
\end{landscape}}
\lipsum[1-3]

\setbox\tempbox=\vbox{\strut
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
\begin{equation}
\begin{split}
x&=\frac{\pi}{2}\\
&=\frac{3}{2}
\end{split}
\end{equation}
Text in same paragraph after equation.
}\unvbox\tempbox
\lipsum[1-2]
\end{document}