1

I created several tex-files (e.g. one for the cover, the TOC, the intro, main, appendix). Each of them has its own preamble. I think this is important because I do different commands regarding margin, line pitch, includes etc.

Each of the files can be compiled fine and looks like what I want.

I then have an overall.tex where I just want to include/ import the other tex files such that they are displayed in iverall.tex as they are compiled on their own.

Unfortunaltely this does not work very good.

At first, my overall.tex begins with

\documentclass[12pt, a4paper]{article}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}

Each other feil begins with

\documentclass[float=false, crop=false, class=article, 12pt, a4paper]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}

I one tex file I am also using

\usepackage[total={6in, 9in}]{geometry}

for being able to use more space for my text (mainly in the footer because I switched page numbering off there by

\pagenumbering{gobble}

As said this compiles fine. When just importing via

\import{/}{00_Title}

it seems to "forget" the margins. As I understood standalone it shouldnt. Thats why I then put in overall.tex just before the import

\newgeometry{total={6in, 9in}}

This works now.

I then did another import for another file just the same way. Within this other file there I have amongst others

\renewcommand{\baselinestretch}{1.5}

Although the second import occurs after the first one, the line pitch of the second import affects also the contents of the first import. Thats why I am doing explicitly a baselinestrech of 1.0 just before the first import and reset it to 1.5 just before the second import. This works now.

Unfortunately since doing the above changes there occurs an almost empty page at the very top of the resulting document containing just a comma. It does not occur in either of the single compiles. It disappears when removing the first import or the changes above. I am ignoring this first page having roman page numbering, going to print it and then just waste it.

When now including the third tex containing a) an import itself and b) citations this lead to an error per citation. I have another tex containing just all citations but no preamble at all. This tex is imported (until now without standalone) by the third tex to be imported in overall.tex such that I can use citation in this third tex. This works pretty fine when compiling it on its own. When now importing via standalone into another (overall) tex it gives an error per citation. The Output is also muck.

Because I am now trying since about 5 hours to get standalone working I am asking whether a) I am doing something wrong or b) there's another way to just concatenate tex files (inclusive page numbering and TOC support).

If not I think the simplest way is to re-integrate every content into a single file but the title page.

This is what my overall.tex looks like:

\documentclass[12pt, a4paper]{article}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}

\usepackage[a4paper]{geometry}

\renewcommand{\baselinestretch}{1.5}

\usepackage[utf8]{inputenc}
\usepackage[german]{babel}


\pagenumbering{gobble}

\begin{document}

\newgeometry{total={6in, 9in}}

\renewcommand{\baselinestretch}{1.0}
\import{/}{00_Title}

\restoregeometry

\pagenumbering{roman}

\renewcommand{\baselinestretch}{1.5}
\import{/}{01_TOC}

\newpage

\pagenumbering{arabic}
\import{/}{02_Intro}



\end{document}

my title page looks like this:

\documentclass[float=false, crop=false, class=article, 12pt, a4paper]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}

\usepackage[utf8]{inputenc}
\usepackage[total={6in, 9in}]{geometry}

\usepackage{graphicx}
\graphicspath{ {Images/} }

\usepackage{afterpage}

\newcommand\blankpage{%
    \null
    \thispagestyle{empty}%
    \addtocounter{page}{-1}%
    \newpage}

\begin{document}

\pagenumbering{gobble}

\begin{center}

{\small
University of\\\vspace{0,1cm}
Math and Science\\\vspace{0,1cm}
Databases\\\vspace{0,1cm}
Prof. Dr. X\\
}

\vspace{1,0cm}

{\LARGE
Tile on first line with much words and so\\\vspace{0,1cm}
Tile on first line with much words and\\\vspace{0,1cm}
Tile on first line with much words and so on\\
}

\vspace{1,5cm}

\includegraphics[width=0.1\textwidth]{Uni_hagen_logo}

\vspace{1,25cm}

{\Large Master Thesis\\\vspace{0,5cm}
Master of Science IT}

\vspace{1,25cm}

{\small
written by\\\vspace{0,1cm}
its me mario\\\vspace{0,1cm}
mario@louigi.bowser\\\vspace{0,1cm}
identnumber\\
}

\vspace{1,5cm}

{\small
overwatched by\\\vspace{0,1cm}
Prof. Dr. X\\\vspace{0,1cm}
Dr. Y\\
}

\vspace{2,0cm}

{\small
February 2017
}

\end{center}

\afterpage{\blankpage} \newpage



\end{document}

my toc looks like:

\documentclass[float=false, crop=false, class=article,12pt, a4paper]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}

\usepackage[utf8]{inputenc}
\usepackage[german]{babel}


\pagenumbering{roman}


\begin{document}

\begin{flushleft}

\section*{Erklärung}
"`Ich versichere, dass ich die von mir vorgelegte Arbeit selbständig angefertigt und andere als die angegebenen Hilfsmittel nicht benutzt sowie jede wörtlich oder inhaltlich übernommene Stelle kenntlich gemacht habe."' \\[14cm]

%TODO: hardcode the finishing date here
\today \hspace{5.3cm} The Author 

\newpage

% --- TABLE OF CONTENTS ---
\tableofcontents

\end{flushleft}

\end{document}

my bib-tech (the one without preamble) looks like:

\usepackage[final]{microtype}

\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt,
maxbibnames=99
]{biblatex}

\addbibresource{bib/work1.bib}
...
\addbibresource{bib/work2.bib}

my third tex throwing the errors looks like

\documentclass[float=false, crop=false, class=article, 12pt, a4paper]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage[utf8]{inputenc}
\renewcommand{\baselinestretch}{1.5}

\usepackage{import}
\import{/}{bibImport.tex}

\usepackage{graphicx}
\graphicspath{ {Images/} }

\begin{document}


\section{Introduction}
\begin{flushleft}

Ipsum Lorem etc. \cite{Work1}. Do you know this one? Two submarines are flying over the mountainss. Says one to the other: let me once a while in the middle.\newline
[...]

\end{flushleft}

\end{document}

I am not sure whether this will ever end working on compatibility for the standalone package. Also I am using some of the files (e.g. the bib import without preamble) for other files (dedicated preview of references).

Hopefully someone knows some magic things or so. Thanks in advance.

  • 2
    you've gone back to using import after the previous question? just using standard latex input would be much easier here. – David Carlisle Dec 27 '16 at 2:24
  • no I am still using \input as you suggested to include my algorithm2e snippets. – Kaspatoo Dec 27 '16 at 11:05
  • But in this case it does not help since I cannot work with different preambles. And I am not going to make one file only having all commands and beeing the only one compilable. I would rather like to be able to compile each tex I have before including it. – Kaspatoo Dec 27 '16 at 11:06
  • and before asking, yes I tried using \input but failed because of usage of pictures when trying to use \includegraphics I get compilation errors saying I need to use \usepackage{graphicx} \graphicspath{ {Images/} } but these I need to use within preamble but \input does not allow usage of preamble, so as I understand I am not able to "just" use \input did I missunderstood something? thanks – Kaspatoo Dec 27 '16 at 11:24
  • The subpreambles option of standalone will make use of the preambles from sub-files when you use \input. It combines them, basically. \import is not a standalone command, though. I don't know about combining import and standalone, though. No idea if that works. – cfr Dec 27 '16 at 13:37
1

I now rearranged my project.

Every tex is without preamble and so not compilable.

For every such tex I created another Wrapper-Tex containing the neccessary preamble and commands etc. The wrapper imports its content-file via \input.

This way I am able to compile every tex on its own but with circumstances via only the wrapper.

Then theres on overall.tex containing all commands of all preambles of all wrappers and including every tex also via \input.

I am using things like renewcommand or restoregeometry or newgeometry to change styling.

Well, its woking yes, thanks. But I its not very comfortable and intuitive. Looking back I would wish that theres a hint about such wrapper files needed when working with import input etc.

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.