Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly set up subfiles #48

Closed
hmemcpy opened this issue Oct 1, 2017 · 5 comments
Closed

Correctly set up subfiles #48

hmemcpy opened this issue Oct 1, 2017 · 5 comments

Comments

@hmemcpy
Copy link
Owner

hmemcpy commented Oct 1, 2017

See https://www.sharelatex.com/learn/Multi-file_LaTeX_projects

This might help with pandoc/epub conversions (#46)

@Blaisorblade
Copy link
Contributor

FWIW, just keeping chapters in separate files doesn't require subfile.

Apparently, that package lets you compile chapters independently* — which is pretty cool (normally one has to resort to \include and \includeonly, which works but is pretty annoying). So if you don't use that feature, maybe dropping subfile is an (inconvenient) solution. (I suspect conditional compilation with the comment package might help disabling subfile when annoying, but this can be tricky—and pandoc wouldn't get it either).

From subfile docs (which I find on TeXLive through texdoc subfiles, recommended or on CTAN at http://ctan.mirror.garr.it/mirrors/CTAN/macros/latex/contrib/subfiles/subfiles.pdf):

With the subfiles set, the typesetting of a multi-file project consisting of one main file and one or more subsidiary files (subfiles) is more comfortable, since the user can LATEX either the main file, which will \input the subfiles normally, or the subfiles by themselves, which take the preamble of the main file and become self-sufficient LATEX documents.

@Blaisorblade
Copy link
Contributor

(BTW checking it out, didn't know about it and would have been useful!)

@hmemcpy
Copy link
Owner Author

hmemcpy commented Oct 2, 2017

I initially went with subfiles because I didn't want to put everything in one giant .tex file (to allow working on individual chapters separately). In addition, I had to add this:

\usepackage{subfiles}
\makeatletter
\let\org@subfile\subfile
\renewcommand*{\subfile}[1]{%
\filename@parse{#1}% LaTeX's file name parser
\expandafter
\graphicspath\expandafter{\expandafter{\filename@area}}%
\org@subfile{"#1"}%
}
\makeatother

so that the images could be embedded using relative path.

@Blaisorblade
Copy link
Contributor

Blaisorblade commented Oct 2, 2017

I initially went with subfiles because I didn't want to put everything in one giant .tex file (to allow working on individual chapters separately).

To rephrase: if you want just that, the main file just needs to use \input{chapter1}, without subfile, and \input just inlines the content of chapter1.tex.
EDIT: so for that goal subfile is indeed unnecessary.

@hmemcpy
Copy link
Owner Author

hmemcpy commented Sep 17, 2018

Closing this for now. The way I have it set up lets me include relative images, and I don't want to spend anymore time on this.

@hmemcpy hmemcpy closed this as completed Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants