我有一个表格代码,它应该适合文本宽度,但不知何故却不适合。有什么想法吗?
\documentclass {article}
\usepackage [T2A] {fontenc}
\usepackage [utf8] {inputenc}
\usepackage [english,russian] {babel}
\usepackage{longtable}
\usepackage{array}
\usepackage{tabu}
\usepackage{lipsum}
\begin{document}
\lipsum[1-1]
\tabulinesep = 1mm
\begin{longtabu} to \textwidth {|c|X[p]|c|c|c|c|c|}
\hline
&
& \multicolumn{5}{c|}{\bfseries Количество часов} \\ \cline{3-7}
%
\bfseries
\begin{tabular}{c}
№ \\ модуля
\end{tabular}
& \centering\bfseries Наименование модулей
& \bfseries Всего
& \multicolumn{3}{c|}{\bfseries%
\begin{tabular}{c}
Аудиторная \\ работа
\end{tabular}}
& \bfseries
\begin{tabular}{c}
Внеауд. \\ работа \\ СР
\end{tabular} \\ \cline{4-6}
&
&
& \bfseries Л
& \bfseries ПЗ
& \bfseries ЛР
&
\\ \hline
\end{longtabu}
\noindent\hrulefill
\end{document}
答案1
我不确定为什么(tabu
通常有点令人惊讶),但用而不是指定内部tabular
环境似乎可以解决问题。@{}c@{}
c
\documentclass {article}
\usepackage [T2A] {fontenc}
\usepackage [utf8] {inputenc}
\usepackage [english,russian] {babel}
\usepackage{longtable}
\usepackage{array}
\usepackage{tabu}
\usepackage{lipsum}
\begin{document}
\lipsum[1-1]
\tabulinesep = 1mm
\begin{longtabu} to \textwidth {|c|X[p]|c|c|c|c|c|}
\hline
&
& \multicolumn{5}{c|}{\bfseries Количество часов} \\ \cline{3-7}
%
\bfseries
\begin{tabular}{@{}c@{}}
№ \\ модуля
\end{tabular}
& \centering\bfseries Наименование модулей
& \bfseries Всего
& \multicolumn{3}{c|}{\bfseries%
\begin{tabular}{@{}c@{}}
Аудиторная \\ работа
\end{tabular}}
& \bfseries
\begin{tabular}{@{}c@{}}
Внеауд. \\ работа \\ СР
\end{tabular} \\ \cline{4-6}
&
&
& \bfseries Л
& \bfseries ПЗ
& \bfseries ЛР
&
\\ \hline
\end{longtabu}
\end{document}