表格总是超出文本宽度

表格总是超出文本宽度

我一直在 Manjaro Linux 上使用 LyX 2.1.4。LyX 运行良好,我可以用它完成高质量的工作,但是表格这个烦人的问题让我无法将工作流程转移到 LyX。如果表格有点复杂,它们就会不断超出文本限制。

我进行了研究,发现此网站上也出现了类似的问题:1234。最后一个甚至被标记为重复。

我的情况有什么不同?之前提出的解决方案都不起作用。似乎最常见的解决方案是添加

\noindent\resizebox{\textwidth}{!}{%

在桌子前

}

之后。

这会导致退出时出现编译错误:

Emergency stop:
File ended while scanning use of \\textenglish.
<*> Progress_report_later.tex

*** (job aborted, no legal \end found)

另外,我期望得到 LyX 答案,而不是纯 LaTeX 答案。是否可以在 LyX 中修复此问题?

编辑 2.Jun感谢您的评论,我按照说明进行了 MWE,但是在匿名化字段并减少文本后,我无法重现相同的错误。

在减少文本之前,这里有更多信息:

[28])
Runaway argument?
{\noindent \resizebox {\textwidth }{!}{\begin {table} \begin {tabular\ETC.
! File ended while scanning use of \\textenglish.
<inserted text> 
                \par 
<*> Progress_report_later.tex

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

! Emergency stop.
<*> Progress_report_later.tex

*** (job aborted, no legal \end found)


Here is how much of TeX's memory you used:
 22263 strings out of 493668
 428192 string characters out of 6150756
 662734 words of memory out of 5000000
 25355 multiletter control sequences out of 15000+600000
 10559 words of font info for 80 fonts, out of 8000000 for 9000
 1328 hyphenation exceptions out of 8191
 61i,11n,75p,21755b,552s stack positions out of 5000i,500n,10000p,200000b,80000s
Output written on Progress_report_later.pdf (28 pages).

以下是加密敏感信息后的 .lyx 文件:

#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass scrartcl
\begin_preamble
%%% LaTeX Template
%%% This template can be used for both articles and reports.
%%%
%%% Copyright: http://www.howtotex.com/
%%% Date: February 2011

%%% Preamble
% Article class of KOMA-script with 11pt font and a4 format
\usepackage{multicol}
\usepackage[english,portuguese]{babel}
% English language/hyphenation
\usepackage{fontspec}
\usepackage[left,modulo]{lineno}

\usepackage[protrusion=true]{microtype}% Better typography
\usepackage{amsfonts}\usepackage{amsthm}% Math packages
% Enable pdflatex
%\usepackage{color,transparent}                                                 % If you use color and/or transparency
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption}% Custom captions under/above floats
\usepackage{epstopdf}% Converts .eps to .pdf
% Subfigures
\usepackage{booktabs}% Nicer tables


%%% Advanced verbatim environment
\usepackage{fancyvrb}\DefineShortVerb{\|}                               % delimiter to display inline verbatim text


%%% Custom sectioning (sectsty package)
\usepackage{sectsty}% Custom sectioning (see below)
\allsectionsfont{%                                  % Change font of al section commands
%\usefont{OT1}{bch}{b}{n}   % bch-b-n: CharterBT-Bold font
%\hspace{15pt}      % Uncomment for indentation
}

\sectionfont{%                                      % Change font of \section command
%\usefont{OT1}{bch}{b}{n}%                  % bch-b-n: CharterBT-Bold font
%\sectionrule{0pt}{0pt}{-5pt}{0.8pt}%   % Horizontal rule below section
}


%%% Custom headers/footers (fancyhdr package)
\usepackage{fancyhdr}
\fancyhead{}                                                        % No page header
\fancyfoot[C]{\thepage}                                     % Pagenumbering at center of footer
\fancyfoot[R]{\small \texttt{HowToTeX.com}} % You can remove/edit this line 
\renewcommand{\headrulewidth}{0pt}              % Remove header underlines
\renewcommand{\footrulewidth}{0pt}              % Remove footer underlines
\setlength{\headheight}{13.6pt}

%%% Equation and float numbering
\numberwithin{equation}{section}                                                            % Equationnumbering: section.eq#
\numberwithin{figure}{section}                                                              % Figurenumbering: section.fig#
\numberwithin{table}{section}                                                               % Tablenumbering: section.tab#


%%% Title   
\title{ \vspace{-1in}   %\usefont{OT1}{bch}{b}{n}
\huge \strut xxx \strut \\
\large \bfseries \strut  \strut
}
\author{                                
\large        xxx\\     %\usefont{OT1}{bch}{m}{n}
\large        The University of xxx\\   %\usefont{OT1}{bch}{m}{n}
\large        Department of xx\\
\small     \texttt{lxxx}
}


%%% Begin document
\end_preamble
\use_default_options false
\begin_modules
fixltx2e
minimalistic
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding default
\font_roman Charter
\font_sans Fira Sans
\font_typewriter Fira Mono
\font_math auto
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing other 1.03
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 2
\use_package amssymb 2
\use_package cancel 1
\use_package esint 1
\use_package mathdots 0
\use_package mathtools 1
\use_package mhchem 0
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date true
\justification true
\use_refstyle 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip 1.5text%
\quotes_language swedish
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Section

\lang australian
Summary and brief timeline
\end_layout

\begin_layout Standard
\begin_inset Float table
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="7">
<features rotate="0" tabularvalignment="middle">
<column alignment="left" valignment="top" width="0pt">
<column alignment="center" valignment="top" width="0pt">
<column alignment="center" valignment="top" width="0pt">
<column alignment="center" valignment="top" width="0pt">
<column alignment="center" valignment="top" width="0pt">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="left" valignment="top" topline="true" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
\size small
Model
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series bold
\shape up
\size small
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
N
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series bold
\shape up
\size small
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
df
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series bold
\shape up
\size small
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
RMSEA
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
\size small
CFI
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
\size small
Chi-square (p-value)
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
\size small
Chi-square diff (p-value)
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
\size small
Reflective
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XXX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
XX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" bottomline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
\size small
MIMIC
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XXX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XXX
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
XXX
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
The fit indices for the semi-equivalent models.
 df, degrees of freedom; RMSEA, Root Mean Square Error of Approximation;
 CFI, Confirmatory Fit Index; Chi-square difference, difference between
 the chi-square of the model with the previous one, followed by the p-value
 of the chi-square difference test (anova).
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_body
\end_document

但随后错误变为:

Latex error: Not in outer par mode
 }

You've lost some text.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

和:

Undefined control sequence:
 }

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

答案1

您的.lyx文件似乎没有显示这一点,但您发布的错误消息表明问题出在哪里:

Runaway argument?
{\noindent \resizebox {\textwidth }{!}{\begin {table} \begin {tabular\ETC.

这告诉我,你将 放在了\resizebox浮动容器 (\begin{table}在代码中 ) 和表格本身 ( \begin{tabular) 的周围,这是错误的。它应该放在浮动容器内,只围绕表格本身。

相关内容