including content from a .tex file outside my main document

AlecB's picture

Hi all, 

How do I include tex content (e.g. a table created with third party software, or some static text) that is in a (non-SW) latex file to my main SW document?

Based on what appears to be the solution for regular latex typesetting, I've tried adding a tex field with the contents:

\begin{tabular}{lccc}

\input{output\table1.tex}

\end{tabular}

But this doesn't work, and neither does placing table1.tex in the same folder as my main SW document and writing "\input{table1.tex}". More generally I was unable to find info on how one would structure a main document to have dependencies on smaller documents.

I need a solution in terms of a link to an outside document, not copy-pasting the latex from my example table into the tex field window in SP.

Thanks for your help,

Alec

When SW compiles a document

When SW compiles a document it will usually create a copy of the document in the temporary directory.  If the document is a master document that refers to subdocuments, the document directory is used as the temporary directory.

There are two ways to be sure that \include or \input file is found.  One is to specify the complete path of the file and the other is to place the file in a directory that LaTeX searches.  The directory TCITeX\TeX and all subdirectories are searched, so the easiest solution is to create a new directory that you use for your include/input files.  You could also change the directories that are searched when the document is compiled.  This is fairly easy for TrueTeX when compiling for DVI, but fairly detailed for pdflatex to compile for PDF (so changing the search directory is not recommended).

AlecB's picture

Many thanks George, placing

Many thanks George, placing the files in TCITeX\TeX resolved the issue.

The first approach didn't, probably because I must be formatting the path wrong. I tried \input{'C:\myfolder\output\trial.tex'} both with single and double quotes.

For unrelated reasons (I'm working inside a dropbox folder that I share with a co-author) placing my output in the TCITeX folder was not convenient for me, so I solved this with a symbolic link/directory junction. For example (win 7), at the command prompt type:

mklink /J "C:\folder_you_actually_want_to_work_in" "C:\swp55\TCITeX\TeX\some_folder_name"

So I can work in the folder that's convenient for me but it will be mirrored within the path that the compiler searches.

Thanks again,

Alec

You can't use backslashes as

You can't use backslashes as the directory delimiter.  Instead of

\input{'C:\myfolder\output\trial.tex'}

using

\input{c:/myfolder/output/trial.tex}

should work.