Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to write pure latex to a separate file and then include that in the LyX document. What are the pros and cons of doing that? As far as I understand there are problems with preamble. Basically what I would like to do is this - write a table to separate latex file and then include that in the document (I would be great if document header and footer came from LyX document.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Go to Insert > File > Child Document. See the section "7.2 Child Documents" in the Help > Embedded Objects manual. It explains how to insert .lyx files, .tex files, and .txt files (verbatim).

share|improve this answer
2  
Thanks, this helped me. As a sidenote to anybody who ever is puzzled about the same thing, .tex file should not include his own preable, but only the content. –  user1335014 Feb 13 '13 at 15:32

You can use \input{foo.tex} or \include{foo.tex} to insert files containing only body text. But these two commands are different. Look for the difference.

share|improve this answer
    
Where is the relation to LyX? –  Daniel Feb 13 '13 at 13:39
    
@Daniel, does not LyX accept command line? –  Sigur Feb 14 '13 at 13:36
2  
While it would be possible to write \input{...} or \include{...} commands into an ERT box, they would usually fail (if relative paths are used, which is good practice), as LyX generates and compiles everything inside a temporary folder. Hence, the mechanism built into LyX, described by scottkosty, is preferable. However, the point is that the answer, as given, is not really helpful anyway: It does not address the OPs issue and instead of writing "Look for the differences" it would be better to describe them briefly. –  Daniel Feb 14 '13 at 14:24
    
@Daniel, OK. I'll delete the usefulness answer. –  Sigur Feb 14 '13 at 15:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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