我正在做我的论文LaTeX
,并且有多个章节,分为不同的.tex 文件并使用包含在main.tex中\include{}
,它正常工作,我可以构建它,而无需返回main.tex文件。
但是在尝试开始另一个章节并直接构建它之后,它显示以下错误:
! LaTeX Error: Missing \begin{document}.
以下是我的序言:
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel} % pone el idioma en español
\setcounter{tocdepth}{3} % pone en TOC hasta la subsubsección
\setcounter{secnumdepth}{3} % enumera hasta la subsubsección
\usepackage{lipsum} % dummy text
\usepackage{graphicx}
\usepackage{geometry} % margenes del documento
\geometry{letterpaper, top = {2,5cm}, bottom = {2,5cm}, inner = {2,5cm},
outer = {2,5cm}, head = {1,1cm}, foot = {1,1cm}, bindingoffset = {1,0cm}}
% Si se va a usar dos paginas por hoja, agregar la opción twoside
\usepackage{helvet} % Arial
\renewcommand{\familydefault}{\sfdefault} % Arial
\usepackage{titlesec} % cambiar modo de ver capitulos y secciones
\titleformat{\chapter}[display]
{\large\bfseries\centering}{\MakeUppercase\chaptertitlename\ \thechapter}{1em}{\MakeUppercase}{} % Cambios en Capitulo
\titleformat{\section}{\large\bfseries}{\thesection.}{1em}{\MakeUppercase}
\titleformat{\subsection}{\normalsize\bfseries}{\thesubsection.}{1em}{\MakeUppercase} % Cambios en SubSección
\titleformat{\subsubsection}{\normalsize\bfseries}{\thesubsubsection.}{1em}{\MakeUppercase} % Cambios en SubSubSección
\titlespacing*{\chapter}{0pt}{-2.5em}{3em} % Cambia el espaciamiento del capitulo de 50pt a lo pedido
\titlespacing*{\section}{0pt}{3em}{2em} % Cambia el espaciamiento de la sección a 3 espacios en blanco antes y 2 despues.
\usepackage{enumitem}
%\setlist[enumerate]{label=\thesection.\arabic*., leftmargin=*}
%\renewcommand*{\theenumi}{\thechapter.\arabic{enumi}} % numero de capitulo en listas
%\renewcommand*{\theenumii}{\theenumi.\arabic{enumi}} % añade lo anterior a sublistas
\usepackage{titletoc}
\titlecontents{chapter}[0em]
{\vspace{0em}}
{\normalfont\normalsize\contentslabel[\thecontentslabel.]{2em}\uppercase}
{\hspace*{-2em}\uppercase}
{\titlerule*[.75em]{.}\contentspage}
\titlecontents{section}[2em]
{\vspace{0em}}
{\normalfont\normalsize\contentslabel[\thecontentslabel.]{2em}\uppercase}
{\hspace*{-2em}\uppercase}
{\titlerule*[.75em]{.}\contentspage}
\titlecontents{subsection}[5em]
{\vspace{0em}}
{\normalfont\normalsize\contentslabel[\thecontentslabel.]{2.9em}\uppercase}
{\hspace*{-2em}\uppercase}
{\titlerule*[.75em]{.}\contentspage}
\titlecontents{subsubsection}[9em]
{\vspace{0em}}
{\normalfont\normalsize\contentslabel[\thecontentslabel.]{3.8em}\uppercase}
{\hspace*{-2em}\uppercase}
{\titlerule*[.75em]{.}\contentspage}
\usepackage{setspace}
\renewcommand{\baselinestretch}{1.5} % interlineado de 1.5
\usepackage[skip=6pt, indent=1cm, tocskip]{parskip} % configurar espacio entre parrafos y sangría izquierda. tocskip genera el salto entre parrafos en el indice
% paquetes necesarios para citar
\usepackage{csquotes}
\usepackage[style=apa, backend=biber, sortcites, url=true]{biblatex}
\addbibresource{bibliografia.bib}
\usepackage{etoolbox}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{} % necesario para poner encabezado en paginas de capítulos
% paquete para encabezado y pie de pagina
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{mystyle}{
\fancyfoot{}
\renewcommand{\thepage}{\ifnum\value{page}<10 0\fi\arabic{page}}
}
\pagestyle{mystyle} % Aplicar el estilo de numeración de página personalizado
\usepackage[labelfont=bf]{caption} %% Formato de pies de foto
\usepackage[]{hyperref}
% - - - - - COMANDOS - - - - -
\newenvironment{itemizecita}{%
\begin{itemize}
\setlength{\leftskip}{1.27cm}
}{%
\end{itemize}
}
\long\def\citalarga#1{%
\medskip
\begingroup
\parindent 0pt
\leftskip=1.27cm
#1
\par
\endgroup
\medskip
}
\long\def\citalargacontinuacion#1{\medskip
\begingroup
\parindent 1.27cm
\leftskip=1.27cm
#1 \par \medskip
\endgroup
}
\long\def\resej#1{\medskip
\begingroup
\parindent 0pt
\leftskip=1.5em
#1 \par \medskip
\endgroup
}
% - - - - - PORTADA - - - - -
\title{\textbf{\MakeUppercase{text}}}
\author{text}
\date{}
\begin{document}
\maketitle
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{}
\fancyhead[R]{}
\fancyfoot[R]{\thepage}
\fancyheadoffset[lh]{2cm}
%% - - - - - RESUMEN EJECUTIVO - - - - -
%
\include{1-resumen-ejecutivo.tex} % works
%
\tableofcontents
% - - - - - INTRODUCCIÓN - - - - -
\clearpage % para que el siguiente comando empiece en una página nueva
\pagenumbering{arabic} % numeración en números arábigos
\include{2-introduccion.tex} % works
% - - - - - CAPÍTULO 1 - - - - -
\include{3-capitulo-1.tex} % works
% - - - - - CAPÍTULO 2 - - - - -
\include{4-capitulo-2.tex} % doesn't work
% - - - - - CAPÍTULO 3 - - - - -
\include{5-capitulo-3.tex}% doesn't work
% - - - - - BIBLIOGRAFÍA - - - - -
\printbibliography
\end{document}
如果我直接构建 main.tex 文件,它会显示包含的章节。直接编译到 chapter-1.text 可以正常工作,但尝试构建 4-chapter-2.tex 或 5-capitulo-3.tex 时会显示错误。
以下是无法直接构建的章节所产生的日志和文件。
。日志:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Arch Linux) (preloaded format=pdflatex 2023.3.10) 28 APR 2023 09:49
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**4-capitulo-2.tex
(./4-capitulo-2.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-04-10>
! Undefined control sequence.
l.1 \chapter
{aaa}
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.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1 \chapter{a
aa}
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Missing character: There is no a in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no a in font nullfont!
Overfull \hbox (20.0pt too wide) in paragraph at lines 1--2
[]
[]
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.3 a
sdkaskdjaskd
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Missing character: There is no a in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no k in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no k in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no j in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no k in font nullfont!
Missing character: There is no d in font nullfont!
Overfull \hbox (20.0pt too wide) in paragraph at lines 3--4
[]
[]
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.5 a
dasdasd
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Missing character: There is no a in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no d in font nullfont!
)
! Emergency stop.
<*> 4-capitulo-2.tex
*** (job aborted, no legal \end found)
Here is how much of TeX's memory you used:
17 strings out of 478238
522 string characters out of 5850456
289994 words of memory out of 5000000
18355 multiletter control sequences out of 15000+600000
469259 words of font info for 28 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
13i,0n,12p,62b,18s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
.bgl:
[0] Config.pm:307> INFO - This is Biber 2.19
[0] Config.pm:310> INFO - Logfile is '/home/jose-tomas/.cache/texstudio/archivos-temporales/4-capitulo-2.blg'
[76] biber:340> INFO - === vie abr 28, 2023, 09:49:56
[101] Utils.pm:410> ERROR - Cannot find '4-capitulo-2.bcf'!
[101] Biber.pm:136> INFO - ERRORS: 1
.辅助:
\relax
\providecommand\hyper@newdestlabel[2]{}
\@writefile{toc}{\contentsline {chapter}{\numberline {3}aaa}{21}{chapter.3}\protected@file@percent }
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\@setckpt{4-capitulo-2}{
\setcounter{page}{22}
\setcounter{equation}{0}
\setcounter{enumi}{1}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{part}{0}
\setcounter{chapter}{3}
\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{figure}{0}
\setcounter{table}{0}
\setcounter{tabx@nest}{0}
\setcounter{listtotal}{0}
\setcounter{listcount}{0}
\setcounter{liststart}{0}
\setcounter{liststop}{0}
\setcounter{citecount}{0}
\setcounter{citetotal}{0}
\setcounter{multicitecount}{0}
\setcounter{multicitetotal}{0}
\setcounter{instcount}{34}
\setcounter{maxnames}{2}
\setcounter{minnames}{1}
\setcounter{maxitems}{999}
\setcounter{minitems}{1}
\setcounter{citecounter}{0}
\setcounter{maxcitecounter}{0}
\setcounter{savedcitecounter}{0}
\setcounter{uniquelist}{0}
\setcounter{uniquename}{0}
\setcounter{refsection}{0}
\setcounter{refsegment}{0}
\setcounter{maxextratitle}{0}
\setcounter{maxextratitleyear}{0}
\setcounter{maxextraname}{2}
\setcounter{maxextradate}{0}
\setcounter{maxextraalpha}{0}
\setcounter{abbrvpenalty}{50}
\setcounter{highnamepenalty}{50}
\setcounter{lownamepenalty}{25}
\setcounter{maxparens}{3}
\setcounter{parenlevel}{0}
\setcounter{blx@maxsection}{0}
\setcounter{mincomprange}{10}
\setcounter{maxcomprange}{100000}
\setcounter{mincompwidth}{1}
\setcounter{afterword}{0}
\setcounter{savedafterword}{0}
\setcounter{annotator}{0}
\setcounter{savedannotator}{0}
\setcounter{author}{0}
\setcounter{savedauthor}{0}
\setcounter{bookauthor}{0}
\setcounter{savedbookauthor}{0}
\setcounter{commentator}{0}
\setcounter{savedcommentator}{0}
\setcounter{editor}{0}
\setcounter{savededitor}{0}
\setcounter{editora}{0}
\setcounter{savededitora}{0}
\setcounter{editorb}{0}
\setcounter{savededitorb}{0}
\setcounter{editorc}{0}
\setcounter{savededitorc}{0}
\setcounter{foreword}{0}
\setcounter{savedforeword}{0}
\setcounter{holder}{0}
\setcounter{savedholder}{0}
\setcounter{introduction}{0}
\setcounter{savedintroduction}{0}
\setcounter{namea}{0}
\setcounter{savednamea}{0}
\setcounter{nameb}{0}
\setcounter{savednameb}{0}
\setcounter{namec}{0}
\setcounter{savednamec}{0}
\setcounter{translator}{0}
\setcounter{savedtranslator}{0}
\setcounter{shortauthor}{0}
\setcounter{savedshortauthor}{0}
\setcounter{shorteditor}{0}
\setcounter{savedshorteditor}{0}
\setcounter{narrator}{0}
\setcounter{savednarrator}{0}
\setcounter{execproducer}{0}
\setcounter{savedexecproducer}{0}
\setcounter{execdirector}{0}
\setcounter{savedexecdirector}{0}
\setcounter{with}{0}
\setcounter{savedwith}{0}
\setcounter{labelname}{0}
\setcounter{savedlabelname}{0}
\setcounter{institution}{0}
\setcounter{savedinstitution}{0}
\setcounter{lista}{0}
\setcounter{savedlista}{0}
\setcounter{listb}{0}
\setcounter{savedlistb}{0}
\setcounter{listc}{0}
\setcounter{savedlistc}{0}
\setcounter{listd}{0}
\setcounter{savedlistd}{0}
\setcounter{liste}{0}
\setcounter{savedliste}{0}
\setcounter{listf}{0}
\setcounter{savedlistf}{0}
\setcounter{location}{0}
\setcounter{savedlocation}{0}
\setcounter{organization}{0}
\setcounter{savedorganization}{0}
\setcounter{origlocation}{0}
\setcounter{savedoriglocation}{0}
\setcounter{origpublisher}{0}
\setcounter{savedorigpublisher}{0}
\setcounter{publisher}{0}
\setcounter{savedpublisher}{0}
\setcounter{language}{0}
\setcounter{savedlanguage}{0}
\setcounter{origlanguage}{0}
\setcounter{savedoriglanguage}{0}
\setcounter{citation}{0}
\setcounter{savedcitation}{0}
\setcounter{pageref}{0}
\setcounter{savedpageref}{0}
\setcounter{textcitecount}{1}
\setcounter{textcitetotal}{1}
\setcounter{textcitemaxnames}{0}
\setcounter{biburlbigbreakpenalty}{100}
\setcounter{biburlbreakpenalty}{200}
\setcounter{biburlnumpenalty}{0}
\setcounter{biburlucpenalty}{0}
\setcounter{biburllcpenalty}{0}
\setcounter{smartand}{0}
\setcounter{bbx:relatedcount}{0}
\setcounter{bbx:relatedtotal}{0}
\setcounter{caption@flags}{2}
\setcounter{continuedfloat}{0}
\setcounter{Item}{23}
\setcounter{Hfootnote}{0}
\setcounter{bookmark@seq@number}{19}
\setcounter{section@level}{0}
}
答案1
我不知道为什么,但是关闭并再次打开 TeXstudio 后,现在我可以构建章节而无需返回 main.tex 文件。
我认为这可能是一些链接问题,通过重新加载程序可以解决。