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'), typeI' 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'), typeI' 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'), typeI' 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'), typeI' 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'), typeI' 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'), typeI' 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'), typeI' 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'), typeI' 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.

Miquel
  • 103
  • 9
  • 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. – Ulrike Fischer Jul 15 '20 at 17:31
  • @UlrikeFischer sorry! Now it is fine right? Before that is "only" an overfull hbox from a table (I think). – Miquel Jul 15 '20 at 18:12
  • 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 '20 at 18:21
  • Why are you calling \UseRawInputEncoding? – Ulrike Fischer Jul 15 '20 at 18:24
  • @UlrikeFischer I'm not calling \UseRawInputEncoding :-S I actually added it once because searching for solutions to the error, at some post it was solved with that. But as it didn't do anything, I erased it again. What I don't remember is if the error was exactly the same before (but I erased the auxiliary files after deleting this command and compiling again). – Miquel Jul 15 '20 at 18:36
  • What does "use a binary search" mean? – Miquel Jul 15 '20 at 18:37
  • Page 220 must be part of the bibliography. That would fit because I was adding citations when the code broke. – Miquel Jul 15 '20 at 18:41
  • you have not posted any code that would allow anyone to help. A "MWE" is supposed to be something that other people can run to debug the error. No one can run this code. however if you think the error is in the bibliography (the log file would show you, but you) delete the .bbl and check that the error is gone. – David Carlisle Jul 15 '20 at 19:01
  • unrelated to the error you show but the column definitions \newcolumntype{A}{>{\hsize=1.85\hsize}X all look wrong to me, do you use them in a way such that the total hsize is not changed? I'm not sure that's even possible. – David Carlisle Jul 15 '20 at 19:05
  • @DavidCarlisle tell me what I have to post and I will, I have no clue what else I should post. The log file is there and not me nor Ulrike were able to see that it may be the bibliography, I just got it when she said that [220] refers to page 220 (which I had no clue) and I checked what that page is.

    I deleted all files latex creates to compile, including the .bbl and the problem persists.

    Saying you have not done a good job explaining the problem but not saying what else I should post, doesn't really help, I have no clue where the problem comes, what should I post? The whole thesis?

    – Miquel Jul 15 '20 at 19: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. – Ulrike Fischer Jul 15 '20 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 '20 at 19:30
  • The problem disappears if I comment \printbibliography. Does that help? – Miquel Jul 15 '20 at 19:44
  • @Miquel it's quite simple: a MWE should be an example of the problem That is we should be able to take the code and run it and see the error, debug it, test answers and post the tested code. the code you have posted does not help at all it is not a document that can be used, and now you have narrowed it down to the bibliography the error is in code you have not posted at all. You should be able to make a small example with just the bibliography no \include and no \usepackage for packages not used in the example. – David Carlisle Jul 15 '20 at 19:56
  • @DavidCarlisle I know what a MWE is. I didn't claim having given any (see the last part of the first sentence: "I don't really know how to make a MWE") because I had no clue what didn't work. It is impossible to give a MWE when one doesn't know what it is that doesn't work. So I posted all I could think that could help. And it actually did (not the code, only the log; but how could I know?), Ulrike's comments helped narrowing it down to \printbibliography. Without her comments it would have been impossible for me to get it. Now I can try to do a MWE. – Miquel Jul 15 '20 at 20:13
  • 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...) – David Carlisle Jul 15 '20 at 20:37
  • @DavidCarlisle, that was useful! – Miquel Jul 15 '20 at 20:48
  • I finally found it. The main problem is that I needed to delete the auxiliary files every time the problem arised in order to search for the source of the error, if not the error persisted even if the source was commented. I really wonder how difficult would it be to make Latex more specific with the errors and avoid needing to delete files to find errors. Overleaf at least has solved the later. The error was simply that a particular citation had special characters. – Miquel Jul 18 '20 at 10:38

0 Answers0