下面我包括了一個mwe。正如您所看到的,在最後一個圖中,最後三個框的錯誤呈現在下一頁。我怎樣才能解決這個問題?我使用 TexShop 進行編譯,它使用此命令pdftex --file-line-error --synctex=1
。是的,我已經編譯過兩次以上了。
\documentclass[11pt, letterpaper, oneside]{memoir}
\usepackage{libertine}
\usepackage{libertinust1math}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{enumitem, amssymb}
\usepackage{textcomp}
\usepackage[tracking = true, letterspace = 125]{microtype}
\usepackage{soul}
\usepackage{mfirstuc}
\usepackage{scalerel}
\usepackage[skins, raster]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.markings}
\usepackage{etoolbox}
\usetikzlibrary{optics}
\usepackage{draftwatermark}
\usepackage[pass]{geometry}
\usepackage[hyphens]{url}
\usepackage{hyperxmp}
\usepackage{hyperref}
\usepackage{xfrac}
\usepackage{multicol}
\usepackage[english]{babel}
\usepackage{blindtext}
% force LaTeX to write the author, title, and copyright into the PDF
\makeatletter
\AtEndDocument{\hyxmp@find@metadata\hyxmp@embed@packet}
\makeatother
\hypersetup{
colorlinks=true,
linktoc=all,
urlcolor=blue,
linkcolor=part,
draft=false,
pdfauthor={some authoer},
pdftitle={some org},
pdfcopyright={Copyright \copyright~2019 by author. Some rights reserved.},
pdfpagelabels=true,
implicit=false
}
\chapterstyle{ell}
\setlength{\emergencystretch}{6pt}
\setlrmarginsandblock{1in}{1in}{*}
\checkandfixthelayout
\linespread{1.3}
%%%%%%%%%%%%%%%%%%%%%%%%%%
% The Document
%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\title{A Title}
\author{An Author}
\date{}
\maketitle
\frontmatter
\blindtext
\mainmatter
\Blindtext
\tcbset{enhanced, nobeforeafter, sidebyside align=top,box align=center, width=1.6in}
\begin{center}
\begin{tcolorbox}[remember as=one]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=two]
a result
\end{tcolorbox}
\end{center}
\begin{center}
\begin{tcolorbox}[remember as=three]
Many more somethings happen and the world nearly dies
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=four]
a result
\end{tcolorbox}
\end{center}
\begin{center}
\begin{tcolorbox}[remember as=five]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=six]
a result
\end{tcolorbox}
\end{center}
\begin{tikzpicture}[overlay,remember picture,line width=0.5mm]
\draw[->] (one.east) to (two.west);
\draw[->] (three.east) to (four.west);
\draw[->] (five.east) to (six.west);
\end{tikzpicture}
\blindtext
\begin{center}
\begin{tcolorbox}[remember as=1]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=2]
a result
\end{tcolorbox}
\end{center}
\begin{center}
\begin{tcolorbox}[remember as=3]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=4]
a result
\end{tcolorbox}
\end{center}
\begin{center}
\begin{tcolorbox}[remember as=5]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=6]
a result
\end{tcolorbox}
\end{center}
\begin{tikzpicture}[overlay,remember picture,line width=0.5mm]
\draw[->] (1.east) to (2.west);
\draw[->] (3.east) to (4.west);
\draw[->] (5.east) to (6.west);
\end{tikzpicture}
\backmatter
\blindtext
\end{document}
答案1
只需將 tikzpicture 放在相同的center
環境中即可強制它位於同一頁面中... LaTeX 決定將colorbox 放置在下一頁中,但在上一頁中再三考慮後改變了主意並強制... tikz 圖片在外面環境並沒有遵循 LaTeX 的第二個想法,因為它是在第二次內部編譯後打印的(需要比真正的 tikzpicture 多一個作為覆蓋)...希望有所幫助。
\documentclass[11pt, letterpaper, oneside]{memoir}
\usepackage{libertine}
\usepackage{libertinust1math}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{enumitem, amssymb}
\usepackage{textcomp}
\usepackage[tracking = true, letterspace = 125]{microtype}
\usepackage{soul}
\usepackage{mfirstuc}
\usepackage{scalerel}
\usepackage[skins, raster]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.markings}
\usepackage{etoolbox}
\usetikzlibrary{optics}
\usepackage{draftwatermark}
\usepackage[pass]{geometry}
\usepackage[hyphens]{url}
\usepackage{hyperxmp}
\usepackage{hyperref}
\usepackage{xfrac}
\usepackage{multicol}
\usepackage[english]{babel}
\usepackage{blindtext}
% force LaTeX to write the author, title, and copyright into the PDF
\makeatletter
\AtEndDocument{\hyxmp@find@metadata\hyxmp@embed@packet}
\makeatother
\hypersetup{
colorlinks=true,
linktoc=all,
urlcolor=blue,
linkcolor=part,
draft=false,
pdfauthor={some authoer},
pdftitle={some org},
pdfcopyright={Copyright \copyright~2019 by author. Some rights reserved.},
pdfpagelabels=true,
implicit=false
}
\chapterstyle{ell}
\setlength{\emergencystretch}{6pt}
\setlrmarginsandblock{1in}{1in}{*}
\checkandfixthelayout
\linespread{1.3}
%%%%%%%%%%%%%%%%%%%%%%%%%%
% The Document
%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\title{A Title}
\author{An Author}
\date{}
\maketitle
\frontmatter
\blindtext
\mainmatter
\Blindtext
\tcbset{enhanced, nobeforeafter, sidebyside align=top,box align=center, width=1.6in}
\begin{center}
\begin{tcolorbox}[remember as=one]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=two]
a result
\end{tcolorbox}
\end{center}
\begin{center}
\begin{tcolorbox}[remember as=three]
Many more somethings happen and the world nearly dies
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=four]
a result
\end{tcolorbox}
\end{center}
\begin{center}
\begin{tcolorbox}[remember as=five]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=six]
a result
\end{tcolorbox}
\begin{tikzpicture}[overlay,remember picture,line width=0.5mm]
\draw[->] (one.east) to (two.west);
\draw[->] (three.east) to (four.west);
\draw[->] (five.east) to (six.west);
\end{tikzpicture}
\end{center}
\blindtext
\begin{center}
\begin{tcolorbox}[remember as=1]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=2]
a result
\end{tcolorbox}
\end{center}
\begin{center}
\begin{tcolorbox}[remember as=3]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=4]
a result
\end{tcolorbox}
\end{center}
\begin{center}
\begin{tcolorbox}[remember as=5]
Something happens
\end{tcolorbox}
\qquad
\begin{tcolorbox}[remember as=6]
a result
\end{tcolorbox}
\begin{tikzpicture}[overlay,remember picture,line width=0.5mm]
\draw[->] (1.east) to (2.west);
\draw[->] (3.east) to (4.west);
\draw[->] (5.east) to (6.west);
\end{tikzpicture}
\end{center}
\clearpage
\backmatter
\blindtext
\end{document}