0

I have a huge document using lots of packages, I use \include{chapter} to make it manageable and I don't have a clue where the error can come from, so I don't really know how to make a MWE.

When this error appeared I undid all the changes I did in the chapter (which is separate file) since the last compilation and the error persists. These changes were mainly adding citations (`\parencite{citation}'). The error persists if I compile other chapters without eliminating all the auxiliary files; if I eliminate them, the other chapters compile fine. So I guess the error must be in the preamble of the main file although I didn't make any change, at least not on purpose. If I use overleaf to compile the document, it gives me the same error also only compiling the same chapter, so the problem should not come because of any missing upgrade (I upgraded MikTek anyway). The error points to a row of the chapter where there is no code (if I comment the code around the error, the error persists) and it doesn't tell me what it is that Latex does not understand, so I don't know where to search.

This is the preamble (sorry I don't know what to keep for the MWE):

\documentclass[11pt, a4paper, oneside]{report}

%-----------------Packages used-----------------------

\usepackage[utf8]{inputenc} % which type of code to use to input special characters and accepts accents!
\usepackage[T1]{fontenc} % better fonts, less problems with copy-paste with accents, straight quotes

\usepackage{chngcntr} % to be able to change the numbering "depth"
    \counterwithin{figure}{subsection} % make figures show subsection number
    \counterwithin{table}{subsection} % make tables show subsection number

\usepackage{blindtext}

\usepackage{enumitem} % To control enumerate style

\usepackage{graphicx} % for managing the graphics
    \graphicspath{{images/}} % for 'graphicx' to know where the images are
    
\usepackage{rotating} % to allow sideways figures ¿and tables? (rotated 90º)
\usepackage{caption} % to use \captionof{figure}{Test figure.} which in minitap allows figures and equations side by side

\usepackage[left=4cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry} % control the geometry of the page

\usepackage[backend=biber, style=apa]{biblatex}
    \addbibresource{bibliography/Institutions.bib}
    \addbibresource{bibliography/Thesis.bib}
%\bibliographystyle{unsrt}


\usepackage{fancyhdr} % to have and control headers and fooders
\pagestyle{fancy}
%\fancyhead{}  % These and the two next come from the Annual review
%\fancyhead[L]{\ttl}
%\fancyhead[R]{\nom}

\usepackage{setspace} % to control the space between lines
    \onehalfspacing % for package 'setspace' to set 1.5 space between lines (from setspace)

\usepackage{amsmath} % More options for writing equations
\usepackage{amssymb} % access to many symbols, check (tick) symbol
\usepackage{ragged2e}


%%%%%% TABLES %%%%%%%
\usepackage{booktabs} % nicer tables stuff
\usepackage{array} % More options for tables
    \newcolumntype{B}[1]{>{\centering\arraybackslash}b{#1}} % to be able to center (bottom) content of cells with defined width
\usepackage{multirow} % Allows cells to spand in multiple rows.
\usepackage[table]{xcolor} % Allows rows to be coloured
\usepackage{tabularx} % To be able to adjust the total width of the table
%\newcolumntype{b}{X} % For wider columns
    \newcolumntype{s}{>{\hsize=.6\hsize}X} % For narrower columns of indicators
    \newcolumntype{S}{>{\hsize=1.1\hsize}X} % For narrower columns
    \newcolumntype{a}{>{\hsize=.35\hsize}X} % For narrower columns of indicators
    \newcolumntype{A}{>{\hsize=1.85\hsize}X} % For narrower columns
    \newcolumntype{L}[1]{>{\RaggedRight\hsize=#1\hsize\linewidth=\hsize}X}
\usepackage{makecell} % You can make a cell with various text lines: \makecell{line1\\line2}
\usepackage{pdflscape}
\usepackage{longtable}
\usepackage{xltabular} % long tabularx
%\usepackage{tabulary} % automatic column widths
%%%%%%%%%%%%%%%%%%%%%%


\usepackage{float} % To be able to use H in figures (H tells latex to put the figure exactly where the code is

\usepackage{color,soul} % To be able to highlight or make coloured text
\usepackage{afterpage} % To be able to force an image to be in the next page instead of in Cuenca
\usepackage{pdfpages} % To be able to include .pdf's, see: https://tex.stackexchange.com/questions/440005/includepdf-jumps-to-new-page-can-i-avoid-that

\usepackage{ragged2e} % To be able to use \justify and other

    \sethlcolor{olive}
    \DeclareRobustCommand{\hlr}[1]{{\sethlcolor{red}\hl{#1}}}
    \DeclareRobustCommand{\hlp}[1]{{\sethlcolor{pink}\hl{#1}}}


\usepackage[all]{nowidow}


\usepackage{textcomp} % access \textquotesingle
\usepackage{hyperref}



%--------- What is compiled? -------------------------

\includeonly{
%   titlepage,
%   abstract,
%   chapters/chapter1,
%   chapters/chapter2,
%   chapters/chapter3,
    chapters/chapter4,
%   chapters/chapter5,
%   chapters/chapter6,
%   chapters/chapter7,
%   chapters/chapter8,
%   chapters/chapter9,
%   chapters/appendix0,
%   chapters/appendix00,
%   chapters/appendix1,
%   chapters/appendix2
}

I wanted to include all the log file but the text is too long and I cannot paste it here. I think this is the part related to the error:

[220]
! Undefined control sequence.
\UseRawInputEncoding ...tencodingname \@undefined 
                                                  \let \DeclareFontEncoding@...
l.342 
      
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.

! Missing \endcsname inserted.
<to be read again> 
                   \let 
l.342 
      
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing \endcsname inserted.
<to be read again> 
                   \let 
l.342 
      
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing \endcsname inserted.
<to be read again> 
                   \let 
l.342 
      
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Undefined control sequence.
<argument> \@undefined 
                       
l.342 
      
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.

! Undefined control sequence.
\UseRawInputEncoding ...tencodingname \@undefined 
                                                  \let \DeclareFontEncoding@...
l.342 
      
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.

! Missing \endcsname inserted.
<to be read again> 
                   \let 
l.342 
      
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing \endcsname inserted.
<to be read again> 
                   \let 
l.342 
      
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing \endcsname inserted.
<to be read again> 
                   \let 
l.342 
      
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Undefined control sequence.
<argument> \@undefined 
                       
l.342 
      
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.


! Package inputenc Error: Unicode character € (U+0080)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.342 
      
You may provide a definition with
\DeclareUnicodeCharacter 


! Undefined control sequence.
<argument> ...ont encoding \let }\global \def \T@ 
                                                  \let \endcsname {\protect ...
l.342 
      
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.

! Undefined control sequence.
<argument> ...tinue without it.}}\global \def \M@ 
                                                  \let \endcsname {\def 7{7}...
l.342 
      
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.

! Package inputenc Error: Invalid UTF-8 byte "9C.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.342 
      
The document does not appear to be in UTF-8 encoding.
Try adding \let utf8\let \GenericError {               }{LaTeX Error: Can be us
ed only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{
Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.}\GenericInfo {(Font)              }{LaTeX
 Font Info:    Redeclaring font encoding \let }\global \def \let \endcsname {\G
enericError {               }{LaTeX Error: Can be used only in preamble}{See th
e LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.}}\global \def \let \endcsname {\def 7{7}}
\xdef PD1{\let }\@tempcnta =1 \def \iterate {\catcode \@tempcnta =15 \advance \
@tempcnta \@ne }\iterate \let \iterate \relax \catcode 0=15 \catcode 9=10 \catc
ode 10=12 \catcode 12=13 \catcode 13=5 \@tempcnta =128 \def \iterate {\catcode 
\@tempcnta =12 \advance \@tempcnta \@ne }\iterate \let \iterate \relax as the f
irst line of the file
or specify an encoding such as \GenericError {               }{LaTeX Error: Can
 be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanat
ion.}{Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.}[latin1]{inputenc}
in the document preamble.
Alternatively, save the file in UTF-8 using your editor or another tool


! Package inputenc Error: Unicode character € (U+0080)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.342 
      
You may provide a definition with
\DeclareUnicodeCharacter 


! Undefined control sequence.
<argument> ...ont encoding \let }\global \def \T@ 
                                                  \let \endcsname {\protect ...
l.342 
      
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.

! Undefined control sequence.
<argument> ...tinue without it.}}\global \def \M@ 
                                                  \let \endcsname {\def 7{7}...
l.342 
      
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.

! Package inputenc Error: Invalid UTF-8 byte "9D.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.342 
      
The document does not appear to be in UTF-8 encoding.
Try adding \let utf8\let \GenericError {               }{LaTeX Error: Can be us
ed only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{
Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.}\GenericInfo {(Font)              }{LaTeX
 Font Info:    Redeclaring font encoding \let }\global \def \let \endcsname {\G
enericError {               }{LaTeX Error: Can be used only in preamble}{See th
e LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.}}\global \def \let \endcsname {\def 7{7}}
\xdef PD1{\let }\@tempcnta =1 \def \iterate {\catcode \@tempcnta =15 \advance \
@tempcnta \@ne }\iterate \let \iterate \relax \catcode 0=15 \catcode 9=10 \catc
ode 10=12 \catcode 12=13 \catcode 13=5 \@tempcnta =128 \def \iterate {\catcode 
\@tempcnta =12 \advance \@tempcnta \@ne }\iterate \let \iterate \relax as the f
irst line of the file
or specify an encoding such as \GenericError {               }{LaTeX Error: Can
 be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanat
ion.}{Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.}[latin1]{inputenc}
in the document preamble.
Alternatively, save the file in UTF-8 using your editor or another tool

[221] [222] [223

]
Appendix E.
[273





]

EDIT: The error disappears if I comment \printbibliography, so it must be something related to this command. But it doesn't make any sense as it was working fine before, for other chapters (separate files) as well as for the same chapter.

18
  • show the earlier parts of the log-file. You are already in the middle of some error. And don't get hectic. Normally such errors are due to small typos, so large changes are not necessary. Jul 15, 2020 at 17:31
  • 1
    That is the initial error, but it looks like we'll need to dig further for the cause. "[220]" indicates page 220. Are you doing anything with the font around that point? I would copy everything to a new directory, delete all but that chapter and the preamble, and then use a binary search to figure out what is causing the problem.
    – Teepeemm
    Jul 15, 2020 at 18:21
  • 1
    You need to find the location of the error. And "you" means "you". You have the document. You can comment parts, you can move \end{document} to exclude part. Make a copy in some test folder and then investigate. Jul 15, 2020 at 19:29
  • 1
    Binary search: delete half of your source code so that you still get the error. Repeat as much as possible so that you still have something that you think should compile but gives you this same error. Something is still calling \UseRawInputEncoding, unless you now have a different error than what you've told us.
    – Teepeemm
    Jul 15, 2020 at 19:30
  • 2
    You can always make a MWE if you have a document that makes an error. remove each of your included chapters in turn checking if you get the error, if you still get the error you do not need that chapter. repeat until you only have one chapter, then replace the \include by copying the text into your main document so you have a single file example, then do the same deleting sections. You have the error example so really only you can do that, anyone else can only make guesses (we can sometimes guess right but...) Jul 15, 2020 at 20:37

0

You must log in to answer this question.

Browse other questions tagged .