0

I am using TexStudio with the subfiles package to split my project into smaller pieces, with the advantage that I can compile a subfile indepentent of the main stuff. Now using the \autoref command of the hyperref package I would like to have auto completion for the labels when working in a subfile, but TexStudio does not give me a list of labels in the other documents.

One way out that I know is to use a %!TEX root = main.tex at the beginning of a subfile, but then maint.tex will always be executed, making the subfiles package useless.

Any ideas how to use \autoref across different subfiles?

  • 1
    Related issue: https://github.com/texstudio-org/texstudio/issues/247#issue-343312506 – Troy Aug 10 '18 at 12:37
  • I am 50% sure about this, but I think referencing files in your structure is somewhat similar to using your own commands, i.e. if you like TeXstudio to recognize your files, there is an option you can check. More here: https://tex.stackexchange.com/questions/251815/how-can-i-have-texstudio-recognize-my-own-commands-which-it-already-auto-complet – henry Jun 02 '20 at 08:09

1 Answers1

1

Instead of using subfiles you could use the \include statement This way you'll compile only the modified files. That should allow you to use %!TEX root = main.tex

Here some useful links:

When should I use \input vs. \include?

https://en.wikibooks.org/wiki/LaTeX/Modular_Documents

  • If I get the \include statement right, I would have to use \includeonly to specify the subfile I want to work with. This would mean I have to change main.tex everytime I start working on another subfile. In particular, since I am using Git, the main.tex file would be seen as edited, even if I did not change anything substantial. All of this is not too bad, but still unconvenient... – Marvin Dippell Aug 10 '18 at 12:35
  • When you use the \include only statement it will use old .aux files for the other chapters. Thus you should initially process the file without \includeonly so that all chapters are processed and usable aux files are generated for each chapter. – Pierpaolo Savina Aug 10 '18 at 13:02
  • @MarvinDippell when you are working mainly on a certain part, you could use \includeonly and not change its arguments, even when you do changes on other subfiles of the document. If you are not making major changes, why bother running that subfiles. Just run the subfiles that might start causing problems because of the changes. Most of the times, those will be major changes and you will inevitably choose to activate that specific file in the \includeonly argument. This is just what I do. – thymaro May 07 '19 at 19:27