关于Latex表格横向的问题

关于Latex表格横向的问题

我的桌子很大,所以我必须把它侧放在乳胶中。这是我的代码

\documentclass{article}
\usepackage{tikz}
\usepackage{rotating}
\begin{document}

\begin{sidewaystable}[h]
    \centering
    \caption{Asset for each operation}
    \label{tab:changeOverCost}
    \begin{tabular}{c|ccccccccccccc}
        & Finger Gripper 1 & Finger Gripper 2 & Finger Gripper 3 & Finger Gripper 4 & Drilling end effector 1 & Drilling end effector 2 & Drilling end effector 3 & Drilling end effector 4 & V-STARS & Leica Metrology & Metrology & Marker 1 & Marker 2 & Marker 3\\
        \hline
        Finger Gripper 1 & ? & &  & & & & & & & & & & &\\
        Finger Gripper 2 & ?&  &  & & & & & & & & & & &\\
        Finger Gripper 3 & ? &  &  & & & & & & & & & & &\\
        Finger Gripper 4 & ? &  &  & & & & & & & & & & &\\
        Drilling end effector 1 &  & ? &  & & & & & & & & & & &\\
        Drilling end effector 2 &  & ? &  & & & & & & & & & & &\\
        Drilling end effector 3 &  & ? &  & & & & & & & & & & &\\
        Drilling end effector 4 &  & ? &  & & & & & & & & & & &\\
        V-Star &  &  & ? & & & & & & & & & & &\\
        Leica Metrology &  &  & ? & & & & & & & & & & &\\
        Marker 1 &  &  &  & ? & & & & & & & & & &\\
        Marker 2 &  &  &  & ?& & & & & & & & & &\\
        Marker 3 &  &  &  & ?& & & & & & & & & &\\
    \end{tabular}
\end{sidewaystable}
\end{document}

请问如何让 latex pdf 中的列与大小匹配,在我目前的使用情况下,pdf 无法显示所有列。此外,有没有关于如何让表格更美观的想法?

答案1

我的主要建议是在标题行中提供一些分组,并尽可能省略重复的材料。我还建议您使用环境tabularx并为 14 个数据列分配相同的宽度。

在此处输入图片描述

\documentclass{article}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters as appropriate
\usepackage{rotating,tabularx,ragged2e,booktabs}
\newcolumntype{C}{>{\Centering\hspace{0pt}}X}

\begin{document}

\begin{sidewaystable}
    \setlength\tabcolsep{3pt} % default: 6pt
    \caption{Asset for each operation}
    \label{tab:changeOverCost}
    
    \medskip
    \begin{tabularx}{1\textwidth}{@{} r @{\quad} *{14}{C} }
        \toprule
        & \multicolumn{4}{c}{Finger Gripper} 
        & \multicolumn{4}{c}{Drilling end effector} 
        & V-Stars 
        & \multicolumn{2}{c}{Metrology}
        & \multicolumn{3}{c@{}}{Marker}\\
        \cmidrule(lr){2-5}   \cmidrule(lr){6-9} 
        \cmidrule(lr){11-12} \cmidrule(l){13-15}
        & 1 & 2 & 3 & 4 & 1 & 2 & 3 & 4 & & Leica & Other & 1 & 2 & 3 \\
        \midrule
        Finger Gripper 1        & ?& & & &  & & & &  & & &  & &  \\
        Finger Gripper 2        & ?& & & &  & & & &  & & &  & &  \\
        Finger Gripper 3        & ?& & & &  & & & &  & & &  & &  \\
        Finger Gripper 4        & ?& & & &  & & & &  & & &  & &  \\
        \addlinespace
        Drilling end effector 1 &  & & & & ?& & & &  & & &  & &  \\
        Drilling end effector 2 &  & & & & ?& & & &  & & &  & &  \\
        Drilling end effector 3 &  & & & & ?& & & &  & & &  & &  \\
        Drilling end effector 4 &  & & & & ?& & & &  & & &  & &  \\
        \addlinespace
        V-Stars                 &  & & & &  & & & & ?& & &  & &  \\
        Metrology-Leica         &  & & & &  & & & & ?& & &  & &  \\
        Metrology-Other         &  & & & &  & & & & ?& & &  & &  \\
        \addlinespace
        Marker 1                &  & & & &  & & & &  & & & ?& &  \\
        Marker 2                &  & & & &  & & & &  & & & ?& &  \\
        Marker 3                &  & & & &  & & & &  & & & ?& &  \\
        \bottomrule
    \end{tabularx}
\end{sidewaystable}
\end{document}

相关内容