1

I'm trying to start my first modular Latex file and I'm using the Wikibook of Latex. I don't know if I'm doing something wrong but I tried to find info about it and I didn't find anything.

I'm using the standalone package and the packages in the child files are not loading. In this case, the package \usepackage[showframe]{geometry} is not loading. The package only loads if I include it in the main file or in the sty file. What I am doing wrong?

These are my files:

main.tex

\documentclass{book}
\usepackage{standalone}
\usepackage{mystyle}

\begin{document}
\input{./tex/dev.tex}
\end{document}

dev.tex

\documentclass{standalone}
\usepackage{../mystyle}

\usepackage[showframe]{geometry}

\begin{document}

\begin{multicols}{2}
\begin{align}
    f(x) &= x^2+uv+u^3xy
\end{align}
\end{multicols}
\end{document}

mystyle.sty

\ProvidesPackage{mystyle}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage{multicol}

\newcommand{\Tau}{\mathcal{T}}
\renewcommand{\r}{\mathbb{R}}
\newcommand{\q}{\mathbb{Q}}
1

As per the standalone documentation:

The package standalone can be used in the main document to skip all extra preambles in included files. The main file must load all packages and settings required by the sub-files.

Thus, it is a requirement to have the main file load all the packages that are required by the sub-files. My recommendation would be to put the \usepackage[showframe]{geometry} in the mystyle.sty.

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.