![\forceversofloat 在对称 tufte-book 中不起作用](https://linux22.com/image/474753/%5Cforceversofloat%20%E5%9C%A8%E5%AF%B9%E7%A7%B0%20tufte-book%20%E4%B8%AD%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我快绝望了。我正在写一个带有对称选项的 tufte-book 类文档,偶数页上的所有图表和表格都居中,就像它们在奇数页上一样。标题始终显示在图像的右侧。
我尝试\forceversofloat
在图形或表格环境中使用该命令,但是它不起作用:没有变化,浮点数总是设置在错误的位置。
这是我的代码:
\documentclass[a4paper,symmetric,openany,nobib]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{geometry, sectsty, graphicx, array, changepage, marginfix, multirow, pgf-pie, amsmath, mathabx, xfrac, upgreek}
\usepackage{lipsum}
\geometry{top=22mm,bottom=18mm,right=27mm,left=20mm,marginparwidth=15mm,marginparsep=4mm}
\setlength{\headheight}{5.0pt}
\begin{document}
\chapter{One}
\lipsum[1]
Here is a floating element on an odd page, and all is fine.
\begin{table}[!htb]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
A&B&C&D&F&G&H&I&J&K&L&M&N&O&P&Q\\ \hline
1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16\\ \hline
\end{tabular}
\end{table}
\lipsum[1]
\newpage
\lipsum[1]
And here is a floating element on an even page, which is treated as if it were on an odd one.
\begin{table}[!htb]
\forceversofloat\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
A&B&C&D&F&G&H&I&J&K&L&M&N&O&P&Q\\ \hline
1&2&3&4&5&6&7&8&9&10&11&12&13&14&15&16\\ \hline
\end{tabular}
\end{table}
\lipsum[1]
\end{document}
答案1
tufte 类定义一个跨越文本区域和侧边距区域的浮动环境,用于将标题放置在边距空间中。
它将生成表格或图形及其标题。在您的示例中,缺少标题,这导致错位。
您可以通过添加标题或(如果没有必要)使用居中表格形式来改善结果。
(1)添加标题
% !TeX TS-program = pdflatex
\documentclass[a4paper,
symmetric,
openany,
nobib]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{%
%% geometry, loaded by the class <<<<<
sectsty, graphicx, array, changepage, marginfix, multirow, pgf-pie, amsmath, mathabx, xfrac, upgreek}
\usepackage{lipsum}
\geometry{%
top=22mm,
bottom=18mm,
right=27mm,
left=20mm,
marginparwidth=15mm,
marginparsep=4mm,
showframe=true, % optional added to show margins <<<<<<<<<<<
}
\begin{document}
\chapter{One}
\lipsum[1]
Here is a floating element on an odd page, and all is fine.
\begin{table}[!htb]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
A&B&C&D&F&G&H&I&J&K&L&M&N&O&P&Q\\ \hline
1&2&3&4&5&6&7&8&1&2&3&4&5&6&7&8\\ \hline
\end{tabular}
\caption{Odd page} % added <<<<<<<<<<<<<<
\end{table}
\lipsum[1]
\newpage
\lipsum[1]
And here is a floating element on an even page, which is treated as if it were on an odd one.
\begin{table}[!htb]
% \forceversofloat % Not needed <<<<<<<<<<<<<
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
A&B&C&D&F&G&H&I&J&K&L&M&N&O&P&Q\\ \hline
1&2&3&4&5&6&7&8&1&2&3&4&5&6&7&8\\ \hline
\end{tabular}
\caption{Even page} % added <<<<<<<<<<<<<<
\end{table}
\lipsum[1]
\end{document}
(2)居中表格
% !TeX TS-program = pdflatex
\documentclass[a4paper,
symmetric,
openany,
nobib]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{%
%% geometry, loaded by the class <<<<<
sectsty, graphicx, array, changepage, marginfix, multirow, pgf-pie, amsmath, mathabx, xfrac, upgreek}
\usepackage{lipsum}
\geometry{%
top=22mm,
bottom=18mm,
right=27mm,
left=20mm,
marginparwidth=15mm,
marginparsep=4mm,
showframe=true, % optional added to show margins <<<<<<<<<<<
}
\begin{document}
\chapter{One}
\lipsum[1]
Here is a non-floating element on an odd page, and all is fine.
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
A&B&C&D&F&G&H&I&J&K&L&M&N&O&P&Q\\ \hline
1&2&3&4&5&6&7&8&1&2&3&4&5&6&7&8\\ \hline
\end{tabular}
\end{center}
\lipsum[1]
\newpage
\lipsum[1]
And here is a non-floating element on an even page, which is treated as if it were on an odd one.
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
A&B&C&D&F&G&H&I&J&K&L&M&N&O&P&Q\\ \hline
1&2&3&4&5&6&7&8&1&2&3&4&5&6&7&8\\ \hline
\end{tabular}
\end{center}
\lipsum[1]
\end{document