specs: win7x64, miktex, texstudio

folder structure:

 - main.tex
 - text.tex

I get expected wider left margin in main.tex:

\usepackage{blindtext} % accessories
\usepackage{showframe} % accessories

    \ifdraft{\geometry{left=6cm, right=1cm, vmargin={2.5cm,3cm}, marginparwidth=5.5cm}}
            {\geometry{left=2.7cm, right=2.7cm, top=2.7cm, bottom=2.7cm}}



However, when I compile text.tex on its own, it does not pick the draft mode:



The left margin is just the normal width.

QUESTION Any ideas on how I can keep this conditional layout for single chapters?

I also use the \usepackage[obeyDraft]{todonotes}, to have notes in that left margin which will disappear under the final mode.

  • subfiles is a bit "hacky", importing the main file while redefining its document environment as "comment" ... have you tested whether it accepts optional arguments of article at all? – J Fabian Meier Aug 21 '15 at 7:14
  • Unfortunately, it accepts only one option, i.e. the main file reference. – Oleg Aug 21 '15 at 12:55
  • By the way, somebody should tell the writer of subfiles (Federico Garcia) about that bug. @Oleg, do you want to write a short e-mail? – Ruben Aug 25 '15 at 18:14
  • @Ruben I already tried before posting but no answer so far. If only latex packages could be improved collaboratively... – Oleg Aug 25 '15 at 19:55



before the \documentclass line (while canceling out the explicit 'draft' option from your class declaration) in the main.tex to make sure that the draft option is active also in your subfile text.tex. The following one-liner is equivalent:


Obviously, once you want to change to 'final' just delete or comment out that line.



You can also specify the 'draft' option directly in your subfile:


It will be discarded anyway when the subfile gets included back to main.tex (see \skip@preamble in subfiles.sty).

Important: Make sure that the parent file name is the last option as subfiles.cls lets the internal macro that saves the parents file name, i.e. \preamble@file, to the \CurrentOption inside a starred option declaration.

Tested with version 1.1 of subfiles from 2012/05/23.

  • I would write in bold the Important(!). Otherwise, really concise/elegant and complete. Thanks – Oleg Aug 25 '15 at 13:20
  • Thanks @OlegKomarov! And I'll change it to bold, it's better ;) – Ruben Aug 25 '15 at 13:44

One more alternative would be to modify subfiles.cls to reset \@classoptionslist before calling LoadClass. Indeed, LoadClass checks that this variable is empty before setting it to the list of options. See this answer for a candidate implementation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.