2

I've written notes for my students and I want to create different versions of them: a short one, to print, and a long one, to distribute them through internet. So for the same content, and I want to compile it twice with different behaviour.

Here is a MWE of what I do:

  • the content of chapter 1 is content1.tex
\begin{document}

This is some text.

\important{This is very important.}

\remark{This is a remark.}

\end{document}
  • the content of chapter 2 is content2.tex
\begin{document}

\important{This is very very very important.}

\remark{This is a useless remark.}

This is some text

\end{document}
  • the file full_version.tex contains a first set of \newcommands:
\documentclass{standalone}

\newcommand{\important}[1]{\textbf{#1}}
\newcommand{\remark}[1]{\textit{Remark: #1}}
  • the file short_version.tex contains a second set of \newcommands:
\documentclass{standalone}

\newcommand{\important}[1]{\textbf{#1}}
\newcommand{\remark}[1]{}

My solution is the following: to compile the content1 with the full_version preamble, I write this command on Linux shell:

 cat full_version.tex content1.tex | latex

It works, but is not very satisfactory (many strange messages); and Linux-shell dependant.

Are there better way to achieve this? Perhaps with precompiled preambles?

JPG
  • 2,019

1 Answers1

1

You can compile using something like:

latex -jobname="full_chapter1" "\input{full_version}\input{chapter1}"