我正在编写一些表格以提供补充信息,但遇到了一个问题。作为背景,我在 M1max MacBook Pro 上使用 TexShop(即运行最新 ARM 版本的 TexShop)。
为了节省空间,我将两个表格合并为一个,使其非常宽,而不是很长(这样它就不会超出页面)。但是,当我测试它是否适合时(我在单独的文档中编译它),编译完成时没有错误,但显示屏上没有出现任何图像(我将在下面发布屏幕截图)。作为测试的一部分,我在文档开头的表格之前添加了几个随机字母,以查看表格是否有问题。同样,显示屏上什么也没有出现。
但是,当我在预览中打开 TexShop 创建的 PDF 时,出现了一页带有随机字母的页面(没有表格)。
说实话,我完全不知道原因是什么,甚至不知道从哪里开始查找问题。即使在创建 MWE(见下文)时,我也希望逐步删除软件包并重新编译以使表格出现……不幸的是,没有这样的运气。
\documentclass[oneside]{report}
\usepackage[top=2cm,bottom=2cm,left=4cm,right=2cm]{geometry}
\geometry{a4paper}
\usepackage{float}
\usepackage[utf8]{inputenc}
%Maths
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage[Symbol]{upgreek}
\usepackage{amsmath}
%SI Units
\usepackage[separate-uncertainty = true, separate-uncertainty-units = single, retain-explicit-plus = true]{siunitx}
% Chemistry packages
\usepackage[layout=staggered-flat, arrows=pgf-filled]{mhchem}
% Table settings
\usepackage{array}
\renewcommand{\arraystretch}{1.5}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{tabularx}
\newcommand{\mc}{\multicolumn}
\newcommand{\mr}{\multirow}
\begin{document}
hbk
\begin{sidewaystable}[H]
\caption{Frequencies and intensities}
\sisetup{table-alignment-mode = marker}
\begin{tabularx}{\textwidth}{l l S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1]}
\toprule
\mc{2}{c}{\mr{3}{*}{\textbf{Assignment}}} & \mc{4}{c}{\textbf{B3LYP-D3/AVQZ}} & \mc{4}{c}{\textbf{DSD-PBEP86-D3(BJ)/AVDZ}} \\
\cmidrule(lr){3-6} \cmidrule(lr){7-10}
& & \mc{2}{c}{\textbf{Harmonic}} & \mc{2}{c}{\textbf{GVPT2}} & \mc{2}{c}{\textbf{Harmonic}} & \mc{2}{c}{\textbf{GVPT2}} \\
\cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8} \cmidrule(lr){9-10}
& & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} \\
\midrule
\mr{6}{*}{\ce{^1H3P}} & \ce{\nu_{3s}} & 2414.5 & 40.1 & 2288.5 & 47.2 & 2458.2 & 41.5 & 2388.6 & 29.5 \\
& \ce{\nu_{3a}} & 2412.1 & 43.1 & 2320.8 & 37.6 & 2455.6 & 44.0 & 2364.8 & 36.4 \\
& \ce{\nu1} & 2403.5 & 34.6 & 2326.5 & 29.6 & 2440.3 & 32.9 & 2325.5 & 44.2 \\
& \ce{\nu_{4s}} & 1136.1 & 10.0 & 1114.7 & 6.6 & 1142.9 & 9.9 & 1120.5 & 7.8 \\
& \ce{\nu_{4a}} & 1136.4 & 11.4 & 1105.4 & 6.8 & 1142.8 & 11.2 & 1123.3 & 7.5 \\
& \ce{\nu_{2}} & 1012.8 & 36.7 & 1006.8 & 25.4 & 1010.4 & 32.2 & 996.3 & 21.3 \\
\bottomrule
\end{tabularx}
\end{sidewaystable}
\end{document}
如果有人能找出我可能做错了什么,我将不胜感激!正如我所说,考虑到没有弹出任何错误消息,我甚至无法想象我做错了什么。
答案1
[H]
不支持该选项rotating
。只需删除该选项,即可打印第 2 页的表格:
\documentclass[oneside]{report}
\usepackage[top=2cm,bottom=2cm,left=4cm,right=2cm]{geometry}
\geometry{a4paper}
\usepackage{float}
\usepackage[utf8]{inputenc}
%Maths
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage[Symbol]{upgreek}
\usepackage{amsmath}
%SI Units
\usepackage[separate-uncertainty = true, separate-uncertainty-units = single, retain-explicit-plus = true]{siunitx}
% Chemistry packages
\usepackage[layout=staggered-flat, arrows=pgf-filled]{mhchem}
% Table settings
\usepackage{array}
\renewcommand{\arraystretch}{1.5}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{tabularx}
\newcommand{\mc}{\multicolumn}
\newcommand{\mr}{\multirow}
\begin{document}
hbk
\begin{sidewaystable}
\caption{Frequencies and intensities}
\sisetup{table-alignment-mode = marker}
\begin{tabularx}{\textwidth}{l l S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1]}
\toprule
\mc{2}{c}{\mr{3}{*}{\textbf{Assignment}}} & \mc{4}{c}{\textbf{B3LYP-D3/AVQZ}} & \mc{4}{c}{\textbf{DSD-PBEP86-D3(BJ)/AVDZ}} \\
\cmidrule(lr){3-6} \cmidrule(lr){7-10}
& & \mc{2}{c}{\textbf{Harmonic}} & \mc{2}{c}{\textbf{GVPT2}} & \mc{2}{c}{\textbf{Harmonic}} & \mc{2}{c}{\textbf{GVPT2}} \\
\cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8} \cmidrule(lr){9-10}
& & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} \\
\midrule
\mr{6}{*}{\ce{^1H3P}} & \ce{\nu_{3s}} & 2414.5 & 40.1 & 2288.5 & 47.2 & 2458.2 & 41.5 & 2388.6 & 29.5 \\
& \ce{\nu_{3a}} & 2412.1 & 43.1 & 2320.8 & 37.6 & 2455.6 & 44.0 & 2364.8 & 36.4 \\
& \ce{\nu1} & 2403.5 & 34.6 & 2326.5 & 29.6 & 2440.3 & 32.9 & 2325.5 & 44.2 \\
& \ce{\nu_{4s}} & 1136.1 & 10.0 & 1114.7 & 6.6 & 1142.9 & 9.9 & 1120.5 & 7.8 \\
& \ce{\nu_{4a}} & 1136.4 & 11.4 & 1105.4 & 6.8 & 1142.8 & 11.2 & 1123.3 & 7.5 \\
& \ce{\nu_{2}} & 1012.8 & 36.7 & 1006.8 & 25.4 & 1010.4 & 32.2 & 996.3 & 21.3 \\
\bottomrule
\end{tabularx}
\end{sidewaystable}
\end{document}
如果您确实想将横向表格与未旋转的文本合并在同一页面上,则可以使用\captionof
和\rotatebox
,例如:
\documentclass[oneside]{report}
\usepackage[top=2cm,bottom=2cm,left=4cm,right=2cm]{geometry}
\geometry{a4paper}
\usepackage{float}
\usepackage[utf8]{inputenc}
%Maths
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage[Symbol]{upgreek}
\usepackage{amsmath}
%SI Units
\usepackage[separate-uncertainty = true, separate-uncertainty-units = single, retain-explicit-plus = true]{siunitx}
% Chemistry packages
\usepackage[layout=staggered-flat, arrows=pgf-filled]{mhchem}
% Table settings
\usepackage{array}
\renewcommand{\arraystretch}{1.5}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{tabularx}
\newcommand{\mc}{\multicolumn}
\newcommand{\mr}{\multirow}
\usepackage{caption}
\usepackage{calc}
\begin{document}
hbk
\begin{center}
\rotatebox{90}{%
\begin{minipage}{\textheight-2\baselineskip}
\captionof{table}{Frequencies and intensities}
\sisetup{table-alignment-mode = marker}
\begin{tabularx}{\textwidth}{l l S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1] S[table-format = 4.1] S[table-format = 3.1]}
\toprule
\mc{2}{c}{\mr{3}{*}{\textbf{Assignment}}} & \mc{4}{c}{\textbf{B3LYP-D3/AVQZ}} & \mc{4}{c}{\textbf{DSD-PBEP86-D3(BJ)/AVDZ}} \\
\cmidrule(lr){3-6} \cmidrule(lr){7-10}
& & \mc{2}{c}{\textbf{Harmonic}} & \mc{2}{c}{\textbf{GVPT2}} & \mc{2}{c}{\textbf{Harmonic}} & \mc{2}{c}{\textbf{GVPT2}} \\
\cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8} \cmidrule(lr){9-10}
& & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} & \mc{1}{Y}{\textbf{Wavenumber}} & \mc{1}{Y}{\textbf{Intensity}} \\
\midrule
\mr{6}{*}{\ce{^1H3P}} & \ce{\nu_{3s}} & 2414.5 & 40.1 & 2288.5 & 47.2 & 2458.2 & 41.5 & 2388.6 & 29.5 \\
& \ce{\nu_{3a}} & 2412.1 & 43.1 & 2320.8 & 37.6 & 2455.6 & 44.0 & 2364.8 & 36.4 \\
& \ce{\nu1} & 2403.5 & 34.6 & 2326.5 & 29.6 & 2440.3 & 32.9 & 2325.5 & 44.2 \\
& \ce{\nu_{4s}} & 1136.1 & 10.0 & 1114.7 & 6.6 & 1142.9 & 9.9 & 1120.5 & 7.8 \\
& \ce{\nu_{4a}} & 1136.4 & 11.4 & 1105.4 & 6.8 & 1142.8 & 11.2 & 1123.3 & 7.5 \\
& \ce{\nu_{2}} & 1012.8 & 36.7 & 1006.8 & 25.4 & 1010.4 & 32.2 & 996.3 & 21.3 \\
\bottomrule
\end{tabularx}
\end{minipage}}
\end{center}
\end{document}
顺便说一句:如果不caption
使用\caption
上述包,表格通常会导致格式错误(标题和表格之间的距离太小)。因此,您也应该caption
在第一个示例中使用包。