1

I have a large LyX file that sometimes gets slow (the output PDF is over 1600 pages with figures, etc.). (Indeed, with LyX 2.3.x it is somehow unbearable and buggy for me, and so I have stuck with 2.2.3.)

How should I split/break it up, so that I can work on a small subset of the entire document at each time, while still being able to output the entire PDF whenever I want to?

Same question but for LaTeX in general: Splitting a large document into several files

  • Haven't tested this, but maybe it's an option to put the complete preamble in a seperate .tex file. Then add \input{preamble.tex} within settings, under Preamble. Also use the button "Save as document details" within the settings window. I think this makes it possible to edit parts using input and include (I assume you are already doing this). With the same preamble and settings added to inputted .tex files, I think in most cases, the parts can be saved as seperate pdf output documents. – JohanFit Oct 17 '18 at 10:42
3

Menu InsertFileChild document → Select the (1) filename and (2) the type of include. (warning: This is for the 2.3.1 versión, so maybe the option is in another submenu in 2.2.3, but I am pretty sure that you will find somewhere in the insert menu).

After accept the changes (press Ok) you can check with ViewCode Preview Pane that this operation will insert the corresponding \input{} or \include{} LaTeX commands, but unlike use directly that commands in an ERT box, this way you can work with child documents in both LaTeX or LyX formats. Of course, in both cases the resulting LaTeX code of the main file will use only the LaTeX version (see image below), i.e., if you working child file is mychildfile.lyx the code will show \input{mychildfile.tex}, not \input{mychildfile.lyx} that obviously cannot work. Note that a right-click in the resulting box Input: mychildfile.lyx allow you to change the type of include or edit the child file.

enter image description here

On the other hand, if you want to use \includeonly{} that David mention in the comments, write it directly in DocumentsSettings...Latex Preamble just as explained in the answer of Bob.

1

I concur with JohanFit who commented just prior to this post. Use the \input{file} and \include{file} commands. The former can be used with any other .tex file and these can be nested in the files that are input in this way. Use the \include{file} command for chapters and the like.

The \input{file} command can indeed be used for the preamble, and even within the preamble. The \include{file} command can neither appear in the preamble nor can it be nested.

To process smaller parts of a document in which you use \include{file}, the command \includeonly{file_list}, filenames separated by commas, in the preamble will process only those included files from the list. This also maintains numbering of chapters, figures, etc while only producing a portion of the document. The source file(s) are processed in the normal way to generate a typeset document - from Lyx or any other editing environment.

  • I'm not sure this really answers the question which is how to be able to process smaller parts of of a document. The answer might be \include and \includeonly but the question asks how to use it from lyx – David Carlisle Oct 17 '18 at 11:53
  • To process smaller parts of a document in which you use \include{file}, the command \includeonly{file list separated by commas} in the preamble will process only those included files from the list. This also maintains numbering of chapters, figures, etc while only producing a portion of the document. The source file(s) are processed in the normal way to generate a typeset document - from Lyx or any other editing environment. – Bob Oct 17 '18 at 12:50
  • I know that but why isn't that the the main part of the answer:-) Also is it clear how to use \includeonly from lyx which generally hides tex syntax (I don't use lyx so I can't say about that) – David Carlisle Oct 17 '18 at 12:55
  • From www.lyx.org/Features: "Access to all LaTeX functionality with capability to insert plain LaTeX code anywhere in a document. " – Bob Oct 17 '18 at 13:03

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.