I'm wanting to split a document into several files as follows and as shows the attached picture:

main file main.tex is in principal folder.

In each chapter file I input 2 files namely header.tex and structure.tex

So for example, in chap1_langFormels.tex file, I have the following file organization:






Here is header.tex source code:

%\usepackage[paperwidth=16cm, paperheight=24cm]{geometry}




\newcolumntype{L}[1]{>{\RaggedRight}X} % new


\setlength{\unitlength}{1cm}    %% Unité

\hypersetup{pdftitle={Title},pdfauthor={Author}} % Uncomment and fill out to include PDF metadata for the author and title of the book



\chapterimage{1.pdf} % Table of contents heading image

\pagestyle{empty} % Disable headers and footers for the following pages


\cleardoublepage % Forces the first chapter to start on an odd page so it's on the right side of the book

\pagestyle{fancy} % Enable headers and footers again

Structure.tex file code is here.

I'm having the following error message:

pdflatex chap1_langFormels.tex 
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.16 \usepackage

The entire chap1_langFormels.log file content is here.

Same problem happens for /principal/main.tex file. Thank you for any help.


I have just tried the following: in chap1_langFormels.tex file when I comment the line inputing structure.tex, there is no longer error. The compilation goes fine. When I uncomment this same line structure.tex in chap1_langFormels.tex file, I get the same error message Missing \begin{document}and showing the same \usepackage{multicol} line as previous. After that I copied the content of header.tex and structure.tex directly into chap1_langFormels.tex to have only one file. After compilation, I got the same error message Missing \begin{document} and showing the same \usepackage{multicol} line as previous. So it look like if this line \usepackage{multicol} in header.tex is in conflict with something in structure.tex.

Folder organization

  • the log you show does not match the input you show, it shows chap1_langFormels.tex being onput and then (without any more files being input) \usepackage being seen on line 16. Jan 28, 2022 at 8:45
  • @DavidCarlisle I have edited the question to add the full log output.
    – cProg
    Jan 28, 2022 at 9:18
  • I don't in general follow external links, I did that time but that is still a truncated file and does not show the error at all, try to cut down your example remove all packages not needed to show the problem, then show the log (or at least theterminal outout) in teh question, the log currently showing in the question is not helping anyone answer. Jan 28, 2022 at 9:23
  • \usepackage {multicol} being seen on line 16 is line 16 of header.tex file
    – cProg
    Jan 28, 2022 at 9:34
  • sorry we try to help but we need some clues. multicol is not on line 16 of the file shown here, the log file shown here does not show header.tex being included and the log file at the external link shows header.tex being included but is incomplete and shows no error. Jan 28, 2022 at 9:39

1 Answer 1


Taking your structure.tex and deleting lines while keeping the error produces a more reasonable test document


\usepackage{microtype} % Slightly tweak font spacing for aesthetics




The second call to microtype generates the error (showing whatever is on the following line, that happens to be multicol here) That looks like a bug in microtype but as you can not load a package twice, just deleting the second call would also work.

The terminal output that matches this test file is

L3 programming layer <2022-01-21>
Document Class: book 2021/10/04 v1.4n Standard LaTeX document class

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.10 \usepackage

Actually the microtypepackage isn't at fault here that combination on a second call to the package (which should give an option clash error) gives a missing begin document error with any package. Investigating...


\usepackage{indentfirst} % Slightly tweak font spacing for aesthetics



  • same here (probably should have reported it back then...)
    – Robert
    Jan 28, 2022 at 14:41
  • @Robert ah thanks, Joseph and I are looking, not sure if we can change the option handler here or at least document this, Jan 28, 2022 at 14:49
  • Thank you @DavidCarlisle for your assistance. Since your first answer I applied your proposition and a new error pop out. So I was trying to get rid of that error in vain. The code has evolve. I have had certain packages twice. Should I open a new discussion to post the new code of my 3 files?
    – cProg
    Jan 28, 2022 at 15:09
  • @cProg feel free to ask a new question but please (as in the answers here) try to make more reasponable test files, it would not have taken you long to do as I did before posting, delete everything that you could delete while still making the error so ending up with a simple one-file test file of a few lines. You did not need three files here. Jan 28, 2022 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .