# Question about setting up workflow for making LaTeX documents containing mathematics

I want to make notes in the form of definitions, theorems, proofs (of theorems), examples and illustrations ( images ). Each definition, theorem, etc. is an item in a ( virtual ) list. The point being that I want to decide at the latest possible moment how to present the information in the form of notes, a book, presentation slides, whatever. - I will make my notes in LaTeX ( using TeXstudio for Windows.) I might need XML or something like Docbook for my needs, I am not sure. I am looking for a small example to start in the right direction. So my notes will look like this.

Definition. A space is a set which admits to some type of structure.
Theorem. Let P,Q be points in the plane. Now P,Q, ....
Proof. Given P,Q. Therefore, ...
Definition. A set is a collection of objects.


The notes as such will be written in LaTeX. I might want to present the notes in several formats. For example, the following three. ( Key is that I want to decide about the presentation issue as late as possible. )

Format 1:
Title
Contents
Chapter 1: Definitions
Chapter 2: Examples
Chapter 3: Theorems
Chapter 4: Proofs

Chapter 1: Definitions
(Section) 1: Space
Definition. A space is a set which admits to some type of structure.
( The word space typeset in bold )
(Section) 2: Set
Definition. A set is a collection of objects.

Chapter 2: Examples
Example 1.
Example 2.


Format 2: The same as above but in cheat-sheet layout, so no title page, contents, just a listing of the notes in multi-column format. See: https://www.sharelatex.com/templates/other/math-cheat-sheet

Format 3: The proofs only. Each proof in slide format, with each paragraph of the proof on a single page.

I have experience in writing LaTeX documents, so I could produce the requested formats but this would involve a lot of duplication of text and so forth. I am looking for the ( unknown to me ) extra step, tool whatever, so that I can fully concentrate myself on the contents of my work and worry about presentation later without duplication of elements. I do understand and accept that this might require ( a lot of ) preparatory work, if it would achieve the goals as outlined above then I am gladly willing to invest the time.

Now the (concrete, answerable) question. Do I need additional tools than TexStudio? If so, which one(s)? If not, what is that I have to do in LaTeX? Make my own document classes perhaps? If so, then how can I create three ( or more ) documents from one text file?

I will appreciate any ideas, tips, examples, pointers in the right direction.

• Have you had a look at pandoc? You can try using Markdown for formatting, latex for math (it is supported) and YAML headers for metadata, plus splitting the notes in different files so you can mix and match. Pandoc will be able to convert it to latex but also to manipulate the metadata... Sep 4, 2015 at 12:59
• No I have not looked at any tools yet, I am not familiar with tools in this area, hence the question. Sep 4, 2015 at 13:01
• @Bordaigorl - I just looked at pandoc.org/try , it might be a start ! Sep 4, 2015 at 13:24

One option is to write your document using semantically meaningful macros that you define, and then \input this document into different document classes (or custom preambles) to typeset it in different ways. You can redefine the commands in each document according to your needs.

This example is just a kind of proof of concept for things you can do. In this example I create three .tex files:

1. notesfile.tex -- This is your base notes file. The notes are written using custom macros that can be defined separately, and the notes themselves are wrapped in macro commands so that you can call them separately.
2. notesbeamer.tex -- This file processes the text from the notes file in the form of a beamer presentation.
3. notesarticle.tex -- This file processes the text from the notes file in an article or handout format.

Save each of these files and then compile the beamer file with pdflatex notesbeamer, and compile the article file with pdflatex notesarticle.

## notesfile.tex

\newcommand{\notesOnLetters}{%
\notesSection{Letters}
A is the first letter.
B is the second.
Z is the last one.%
}

\newcommand{\notesOnNumbers}{%
\notesSection{Numbers}
\begin{mylist}
\item We may assume that $1 + 1 = 2$.
\item That is \strong{addition}.
\end{mylist}%
}


## notesbeamer.tex

\documentclass{beamer}

% Define \notesSection as beamer frame title
\newcommand{\notesSection}[1]{%
\frametitle{#1}%
}
% Define mylist as itemize
\newenvironment{mylist}
{\begin{itemize}}
{\end{itemize}}

% Define \strong as \alert

% Bring in notes accessible through commands defined in notesfile
\input{notesfile}

\begin{document}

\begin{frame}
\notesOnLetters
\end{frame}

\begin{frame}
\notesOnNumbers
\end{frame}

\end{document}


## notesarticle.tex

\documentclass{article}

% Define \notesSection as article \subsection
\newcommand{\notesSection}[1]{%
\subsection{#1}%
}
% Define mylist as enumerate
\newenvironment{mylist}
{\begin{enumerate}}
{\end{enumerate}}

% Define \strong as boldface
\let\strong\textbf

% Bring in notes accessible through commands defined in notesfile
\input{notesfile}

\begin{document}

\title{Things You Should Know}
\author{Professor}
\maketitle

\section{Review}

\notesOnLetters

\section{New Concepts}

\notesOnNumbers

\end{document}


Beamer output:

Article output:

• This is what I had in mind. I intuitively knew that it could be done with latex and this shows how. With this answer I can make a start. Sep 4, 2015 at 16:59