General\include vs. \input

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

\include vs. \input

Post by Singularity »

Hi, I have just learned LaTeX this weekend. I didn't see a forum for stupid newbie questions, so I'm posting here.

Why can't I get \include working (but \input does)?

I am practicing LaTeX by doing my math homework in it. I like to keep organized, so I am going to create a separate .tex file for each question, then use the \include or \input command to create my final homework (Overkill? yes. Good practice? we'll soon know).

\input works as expected. But \include does not work. Following is the outline of my file. What am I doing wrong? Thanks.

HW1.tex

Code: Select all

\documentclass[11pt,fleqn]{amsart}
\usepackage{amssymb} %amsthm,amsmath included in amsart documentclass

\newcommand{\set}[1]{\left\{{#1}\right\}}
\newcommand{\setof}[2]{\left\{{#1}\colon{#2}\right\}}
\newcommand{\Q}[1]{\setcounter{equation}{0}\subsection*{#1:}\;}
\newcommand{\A}[0]{\newline\textbf{Answer$\colon$}}
\renewcommand{\labelenumi}{\alph{enumi}.}
\renewcommand{\theequation}{\alph{equation}}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}

\begin{document}

\include{Section08.tex}
%\input{Section08.tex}

\end{document}
Section08.tex

Code: Select all

\Q{8.1} There are six different French books, eight different Russian books, and five different Spanish books.
\begin{enumerate}
	\item How many different ways can these books be arranged on a bookshelf?
	\A There are $19$ unique books: $19!=1.216451 × 1017$\\
	\item How many different ways can they be arranged if all books in the same language are grouped together?
	\A Each language group can be arranged in \emph{(number-of-books-in-the-group)!} ways. The groups can then be arranged in $3!$ ways. : $6! \cdot 8! \cdot 5! \cdot 3!=20,901,888,000$
\end{enumerate}

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

\include vs. \input

Post by frabjous »

The .tex suffice is added by default, so you could try changing

Code: Select all

\include{Section08.tex}
to

Code: Select all

\include{Section08}
But beyond that, I don't see why there should have been a problem. Your sample documents compile for just fine for me with \include. If you still have problems, could you try uploading the .log file here?

Still, that said, \input probably makes more sense than \include, since you probably don't want each homework section on its own page (unless they're very long).
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Re: \include vs. \input

Post by Singularity »

Just adding an overdue "solved" checkmark.
Post Reply