帮助修复 longtabu(带有 rotatebox 单元格)以适合页面宽度

帮助修复 longtabu(带有 rotatebox 单元格)以适合页面宽度

我在使我的表格适合页面宽度时遇到了一个问题,其中有一些单元格带有旋转框。

这是我的代码:

\documentclass[a4paper,landscape]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry, tabulary, tabularx,ragged2e,booktabs, float,graphics, longtable, tabu}
\geometry{left=1cm,right=1cm,top=1cm,bottom=1in}
\newcolumntype{L}{>{\centering\arraybackslash}X} % centering version of "X"
\setlength{\parindent}{4em} % \par indent
\setlength{\parskip}{1em} % \par new paragraph space
\renewcommand{\baselinestretch}{1.5} % \par line height
\newcommand*\rot{\rotatebox{90}}

\restylefloat{table}
\pagestyle{empty}

\begin{document}
\begin{center}
\textbf{\large Department of Computer Science, College of Computer Studies, Ateneo de Naga University\\
Undergraduate Program: Bachelor of Computer Science}

\begin{longtabu} to \textwidth{@{\extracolsep{\fill}}|l|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|L|} % 52 'l', total columns
\hline
\parbox[b]{2in}{ICST501\par General Psychology with HIV/Aids Education and Drug Abuse and Prevention\strut \par Knowledge Area: THS\strut \par Credit: 3 units \strut \par Prerequisite: NONE \strut}
& \rot{Knowledge for Solving Computing Problems}
& \rot{Problem Analysis}
& \multicolumn{3}{c|}{\rot{Design / Development of Solutions}} 
& \rot{Modern Tool Usage} 
& \rot{Individual and Team Work} 
& \rot{Communication} 
& \rot{Computing Professionalism} 
& \rot{Life-Long Learning} 
& \rot{Filipino Historical \& Cultural Heritage} 
& \multicolumn{10}{c|}{A. Competence} 
& \multicolumn{10}{c|}{B. Conscience} 
& \multicolumn{10}{c|}{C. Compassionate Commitment to Change} 
& \multicolumn{10}{c|}{D. Christ Centeredness}\\ \hline

Learning Outcomes & \rot{CS01} & \rot{CS02} & \rot {CS03} & \rot{CS04} & \rot{CS05} & \rot{CS06} & \rot{CS07} & \rot{CS08} & \rot{CS09} & \rot{CS10} & \rot{6.1 e} & \rot{1} & \rot{2} & \rot{3} & \rot{4} & \rot{5} & \rot{6} & \rot{7} & \rot{8} & \rot{9} & \rot{10} & \rot{1} & \rot{2} & \rot{3} & \rot{4} & \rot{5} & \rot{6} & \rot{7} & \rot{8} & \rot{9} & \rot{10} & \rot{1} & \rot{2} & \rot{3} & \rot{4} & \rot{5} & \rot{6} & \rot{7} & \rot{8} & \rot{9} & \rot{10} & \rot{1} & \rot{2} & \rot{3} & \rot{4} & \rot{5} & \rot{6} & \rot{7} & \rot{8} & \rot{9} & \rot{10} \\ \hline

\end{longtabu}

\end{center}
\end{document}

答案1

使用:

{\tabcolsep=2.5pt
\begin{longtabu} to 
\textwidth{|X|*{51}{l|}}
 % 52 'l', total columns
    \hline
    \parbox[b]{2in}{ICST501\par General Psychology with HIV/Aids 
    Education and 
    Drug Abuse and Prevention\strut \par Knowledge Area: THS\strut \par Credit: 3 
    units \strut \par Prerequisite: NONE \strut}
    & \rot{Knowledge for Solving Computing Problems}
    & \rot{Problem Analysis}
    & \multicolumn{3}{c|}{\rot{Design / Development of Solutions}} 
    & \rot{Modern Tool Usage} 
    & \rot{Individual and Team Work} 
    & \rot{Communication} 
    & \rot{Computing Professionalism} 
    & \rot{Life-Long Learning} 
    & \rot{Filipino Historical \& Cultural Heritage} 
    & \multicolumn{10}{c|}{A. Competence} 
    & \multicolumn{10}{c|}{B. Conscience} 
    & \multicolumn{10}{c|}{C. Compassionate} 
    & \multicolumn{10}{c|}{D. Christ Centeredness}\\ \hline

    Learning Outcomes & \rot{CS01} & \rot{CS02} & \rot {CS03} & \rot{CS04} & 
    \rot{CS05} & \rot{CS06} & \rot{CS07} & \rot{CS08} & \rot{CS09} & \rot{CS10} & 
    \rot{6.1 e} & \rot{1} & \rot{2} & \rot{3} & \rot{4} & \rot{5} & \rot{6} & 
    \rot{7} & \rot{8} & \rot{9} & \rot{10} & \rot{1} & \rot{2} & \rot{3} & \rot{4} 
    & \rot{5} & \rot{6} & \rot{7} & \rot{8} & \rot{9} & \rot{10} & \rot{1} & 
    \rot{2} & \rot{3} & \rot{4} & \rot{5} & \rot{6} & \rot{7} & \rot{8} & \rot{9} 
    & \rot{10} & \rot{1} & \rot{2} & \rot{3} & \rot{4} & \rot{5} & \rot{6} & 
    \rot{7} & \rot{8} & \rot{9} & \rot{10} \\ \hline

\end{longtabu}}

在此处输入图片描述

相关内容