I have a large LaTeX project (my thesis) with a main TeX file (main.tex) and many subfiles contained in their own sub-directory. All are interrelated with the subfiles package.

Now I want to add a title page to appear on the first page of the compiled pdf file, with hebrew text: To include the thesis title, author name and institution name.

The preponderance of the project is best compiled with pdfLatex, and therefore I wish to stick with this one and not change to XeLaTeX.

I successfully compiled a .tex file that contains hebrew AND english letters (titlepage.tex).

I want titlepage.tex to appear first, and after it all the series of chapter0*.tex files.

Now comes the question - how to compile the project properly?

I tried to import the standalone and import packages to main.tex:


and then call for titlepage.tex right after \begin{document}: \usepackage[subpreambles=true]{standalone} \usepackage{import} \begin{docment} \import{./}{titlepage} \end{document}

But nothing compiled - a multitude of errors concerning the standalone.sty file.

Any help?

The hierarchical file structure is as follows:

root folder
| │ figure01
│ │ figure02
│ │ figure03
| │ chapter01
| │ chapter02
| │ chapter03

The main.tex file structure:

\documentclass{tufte-book} % Tufte-book format
\usepackage[english]{babel} % Bibliography
\usepackage{subfiles} % Best loaded last in the preamble
%%% Document %%%
\chapter{Chapter 1}

\chapter{Chapter 2}

\chapter{Chapter 3}

The chpater0*.tex files has just the same document preamble as main.tex.

The Hebrew language file, to be used as a title page:

\usepackage[utf8x]{inputenc} % utf8x for hebrew letters

כיתוב בעברית.
English text.

Note: I compile the the project in overleaf.

  • 1
    In titlepage.tex I'd remove everything up to and including \begin{document} as well as \end{document}, and include the file from main.tex using \input{titlepage}. No standalone and import needed (any packages and definitions that are needed in the title page, put them into the preamble). There is probably no need to compile the titlepage separately. If there is, then use \subfile to load the titlepage.
    – gernot
    Commented Mar 12, 2021 at 22:12

1 Answer 1


I am using Overleaf also with multiple subfiles. I use the command \documentclass[main.tex]{subfiles} to import the preamble of the main into the subfiles. Besides \selectlanguage should be used inside the document I think.

Here is my an example inspired by your MWE that worked for me :

main.tex :

\documentclass{tufte-book} % Tufte-book format
\usepackage[main=english, hebrew]{babel}
\usepackage{subfiles} % Best loaded last in the preamble


%%% Document %%%


\chapter{Chapter 1}




כיתוב בעברית.
English text.

The functions \onlyinsubfile and \notinsubfile can be used in the subfiles and allow you to execute commands depending if you are trying to compile the standalone subfile or the whole document.

Finally for managing biblatex with hebrew caracter look at this answer Using Biblatex with utf8x

  • Thanks a lot for your help! But, I now notice that there is a problem with the figure environment: I get the following errors: Missing \endcsname inserted; Use of \m@^_ doesn't match its definition; Extra \endcsname. Do you have any idea why?
    – tush
    Commented Mar 16, 2021 at 15:51
  • I am not sure how this could be related to the use of subfiles... Could you post a MWE ? Maybe in another question and post the link in comment. I will have a look
    – nlair
    Commented Mar 16, 2021 at 18:38
  • Good idea. The new answer I posted can be found here.
    – tush
    Commented Mar 16, 2021 at 19:18

You must log in to answer this question.

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