LyX 表格范围设置和多页表格错误

LyX 表格范围设置和多页表格错误

我有一个大型 8x8 矩阵,其中有文本,当表格为纵向时,该矩阵超过 8 页。但是当我尝试在表格宽度设置选项卡中指定旋转角度时,出现了missing \endgroup inserted错误! Paragraph ended before \LT@entry was complete

如果我禁用多页表选项,文档可以编译,但显然表格在第一页会被截断。

运行 LyX 2.2.3 和 MiKTeX 2.9 并获取最新更新。

我应该指出,我正在使用 LyX,无法修改此源代码的大部分内容。我还想将此文档作为附录,因此我需要旋转表格,而不是旋转文档。


% Preview source code

%% LyX 2.2.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,oneside]{book}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{array}
\usepackage{longtable}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\makeatletter\@openrightfalse\makeatother

\makeatother

\begin{document}

\chapter{Analysis Grid}

\begin{longtable}[l]{|>{\centering}p{1cm}|>{\centering}p{3cm}|>{\centering}p{2cm}|>{\centering}p{3cm}|>{\centering}p{3cm}|>{\centering}p{3cm}|>{\centering}p{3cm}|>{\centering}p{3cm}|}
\hline 
{\scriptsize{}Code} & {\scriptsize{}Observation} & {\scriptsize{}Value} & {\scriptsize{}Relevance} & {\scriptsize{}Theory} & {\scriptsize{}Data} & {\scriptsize{}Variables and Units} & Links\tabularnewline
\hline 
\endhead
\hline 
{\tiny{}A} &  &  &  &  &  &  & \tabularnewline
\hline 
{\tiny{}B} &  &  &  &  &  &  & \tabularnewline
\hline 
{\tiny{}C} &  &  &  &  &  &  & \tabularnewline
\hline 
{\tiny{}D} &  &  &  &  &  &  & \tabularnewline
\hline 
{\tiny{}E} &  &  &  &  &  &  & \tabularnewline
\hline 
{\tiny{}E} &  &  &  &  &  &  & \tabularnewline
\hline 
{\tiny{}G} &  &  &  &  &  &  & \tabularnewline
\hline 
\end{longtable}

\label{appendix3}
\end{document}

答案1

您的表格太宽(21 厘米),即使旋转也放不进页面。对于旋转的长表格,我建议使用lscape包及其landscape方向并改变页面布局:

\documentclass[12pt,oneside]{book}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose}
%\setcounter{secnumdepth}{3}
%\setcounter{tocdepth}{3}
\usepackage{array, 
            makecell, % <-- added
            longtable}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}
\renewcommand\theadfont{\footnotesize}% <-- added
\usepackage{lscape}% <-- added
\usepackage{ragged2e}% <-- added

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\makeatletter\@openrightfalse\makeatother
\makeatother

\usepackage{lipsum}% for text filler

\begin{document}

\chapter{Analysis Grid}
\lipsum[1-3]

\newgeometry{margin=25mm}% <-- added
\begin{landscape}% <-- added
\footnotesize% <-- added
\begin{longtable}[l]{|c% <-- changged
                     |P{3cm}|P{2cm}|P{3cm}|P{3cm}|P{3cm}|P{3cm}|P{3cm}|}
\hline
\thead[b]{Code} & \thead[b]{Observation} & \thead[b]{Value} & \thead[b]{Relevance} & \thead[b]{Theory} & \thead[b]{Data} & \thead[b]{Variables\\ and Units} & \thead[b]{Links}             \\% <-- changed
\hline
\endhead
\hline
A  & \lipsum*[11] &  &  &  &  &  & \\
\hline
B  & \lipsum*[11]  &  &  &  &  &  & \\
\hline
C  & \lipsum*[11]  &  &  &  &  &  & \\
\hline
D  & \lipsum*[11]  &  &  &  &  &  & \\
\hline
E  & \lipsum*[11]  &  &  &  &  &  & \\
\hline
E  & \lipsum*[11]  &  &  &  &  &  & \\
\hline
G  & \lipsum*[11]  &  &  &  &  &  & \\
\hline
\end{longtable}
\label{appendix3}
\end{landscape}% <-- added
\restoregeometry% <-- added

\lipsum
\end{document}

正如您所见,我添加了包:

  • makecell并将其宏thead用作列标题
  • ragged2e用于智能调整单元格中的较长文本
  • 定义新的列类型P,允许\\使用\tabularnewline
  • lipsum用于在单元格中生成虚拟文本(该表可以跨越八页)。

笔记: lansdcape环境总是从新页面开始。

这就是你要找的吗?

在此处输入图片描述

相关内容