I'm trying to write a document in spanish with multiple files, however I can't compile special characters (á,é,í,ó,ú) in the child files (these compile fine in main file) and I can't add a preamble in the subfiles as it inherits the main preamble. Here's a minimal (not) working example:

Main file:

\usepackage[paperwidth=17cm, paperheight=22.5cm, bottom=2.5cm, right=2.5cm{geometry}


%Spanish writing packages

á é í ñ  % these compile fine when I comment out the child file

\subfile{child}  % include for standalone and subfile for subfiles


Child file:


Tipos de investigación en el capítulo 1 

PS1: I also tried to use the standalone package with the preamble for spanish writen in the child file, but I got the same results.

PS2: I am using TexMakerX, could it be I'm missing some update o that it is poorly installed?

Thank you so much for your help!

  • Welcome to TeX SX! TeXMakerX is the very old name of what has become TeX Studio. Perhaps you should update. Also do you have any reason to not using the simple \include{child}, the latter having no preamble? – Bernard May 11 '17 at 1:11

The closing square bracket of the options for the geometry package is missing. After inserting it (and replacing spanish with ngerman because I have no spanish installed) it compiles on my system.

Check that the child file has the correct encoding (the one specified in the preamble of the main file -- utf8).

Also make sure that the filename of the main file is spelled correctly in the option of the documentclass in the child file. Otherwise it can not find the file and load the preamble.

TexMakerX is merely an editor. Unless it messes up the encoding it should not affect TeX.

  • Thank you, that solved it! The square bracket was a typo here, it was a problem of the encoding in the child file – Pablo May 11 '17 at 14:54

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.