General\input only including first file

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
TomEatWorld
Posts: 2
Joined: Fri Feb 17, 2012 6:21 pm

\input only including first file

Post by TomEatWorld »

I'm quite new to LaTeX so hopefully this should be quite an easy fix.
I'm putting together my first larger file and was looking at using \input in order to gather files together. However, using the code:

Code: Select all

\documentclass[11pt, onecolumn]{article}

\usepackage{graphicx}
\usepackage{fullpage}
\usepackage{sidecap}
\sidecaptionvpos{figure}{c}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{siunitx}
\usepackage[small]{caption}

\input{file1.tex}
\input{file2.tex}
I can only get a single file to be inputted. If I change the first input to become a comment (by adding a % before it) the second file will appear when compiled but removing it only gives the first again. Am I missing something really simple?

Thanks in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

\input only including first file

Post by Stefan Kottwitz »

Hi Tom,

welcome to the board!

What is the content of file1.tex? If it would contain \end{document}, LaTeX would end the document without reading file2.tex.

Stefan
LaTeX.org admin
TomEatWorld
Posts: 2
Joined: Fri Feb 17, 2012 6:21 pm

Re: \input only including first file

Post by TomEatWorld »

Ah brilliant! That's the problem. Thanks!

On a different note, is there an easy way to merge references from two (or more) separate files?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

\input only including first file

Post by Stefan Kottwitz »

If you use \include or \input, no problem, simply use references as usual.

If you would like to refer to other documents, you could use the xr package.

Stefan

PS: Generally, for different questions it would be good to open a new thread.
LaTeX.org admin
Post Reply