Notestex: An All-In-One Notes Package For Students

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

NotesTeX

An All-In-One Notes Package For Students

Aditya Dhumuntarao1
DAMTP, University of Cambridge
Perimeter Institute of Theoretical Physics
University of Minnesota

E-mail: adhumunt@gmail.com

1 My Personal Website
Contents

I Introduction 1
1 Motivation 1

2 Required Packages 1

3 License 1

II Modifications 2
4 Features 2

5 Included Packages 2

6 Margins 3
6.1 Why use both marginnotes and sidenotes? 3

7 TEX Shortcuts 4
7.1 Available Shortcuts 4

8 amsthm Environments 5
8.1 tcolorbox Environment and Known Issues 7

9 The Part Environment 7

10 Fullpage Environment 8
10.1 Known Issues with Fullpage 8

III Advanced Page Formatting 9


11 Page Dimensions 9

12 Fancyhdr Layout 9

–i–
PART

Introduction I
1 Motivation
During my year as a Part III student at Cambridge, I realized that my theoretical physics Section 1. Motivation
professors, namely David Tong and David Skinner, would use the jhep format to typeset Section 2. Required Packages
the notes for their classes. As the year went on, I started typesetting my personal notes Section 3. Margins
during class and realized that the jhep format, while great for publications and lecture
notes in general, was lacking a few small but useful features.
I came across James P. Sethna’s wonderful text on statistical mechanics, published by
the Oxford University Press, and loved the formatting of the OUP. Sadly the OUP does
not have a publicly released LaTeX .sty file for their content, and while the Memoir class
and the Tufte style packages provide extensive functionality, I needed something slightly
different and a package that was more readily modifiable. Enter NotesTeX.
The result of this year long work, from 2016-2017, is the package now known as Notes-
TeX. The purpose of this package was to consolidate all these changes that I slowly incor-
porated into the original jhep format, and to provide stable support for commonly used
physics and mathematics environments. I sincerely hope that you enjoy the package!

2 Required Packages
For NotesTeX, the following packages are required

marginnote, sidenotes, fancyhdr, titlesec, geometry, and tcolorbox.

The roles of each of these packages will be discussed in Part II. However, for a brief
summary, the marginnote, sidenote, titlesec, and tcolorbox packages are used in
creating the \part environment, the package geometry is used globally to set the page
width, page height, and margin width, and finally, fancyhdr, which is overridden on the
title page, the contents page, and the \part page, sets the header for the body.

3 License
Aditya Dhumuntarao does not own the copyright to the original package, jheppub.sty.
All modification have been approved by the Jhep Editorial committee, and permission has
been attributed to Aditya to distribute freely the modified version of jheppub.sty, known
as NotesTeX.sty.
This work may be distributed and/or modified under the conditions of the LaTeX
Project Public License, either version 1.3 of this license or (at your option) any later
version. The latest version of this license is found here, and version 1.3 or later is part
of all distributions of LaTeX version 2005/12/01 or later. The current maintainer of this
work is Aditya Dhumuntarao.1

1 Please contact me at my email if you have any questions or comments.

1
PART

Modifications II
4 Features
Section 4. Features
While NotesTeX 2 inherits most of the jhep formatting for sections, subsections, subsubsec-
Section 5. Included Packages
tions, title page, contents page, and bibliography presets, there are significant departures Section 6. Margins
from the original format and underlying features. The central focus of this package was Section 7. Shortcuts
to expand the use of the margin in order to include; simple marginnotes, numbered side– Section 8. amsthm Environments
Section 9. Part Environment
notes, marginfigures, and margintables. The secondary motivation was to include a list of
Section 10. Fullpage Environment
preloaded packages that any physics or mathematics students would require while type–
setting notes. Lastly, there are a few stylistic improvements that allow for better readability. Table 1. Contents for Part II

NotesTeX includes the following:

1. Several mathematics and physics packages.

2. Margins and margin environments for tables, figures, and asides.

3. TEX shortcuts for various math scripts namely vector bold math, mathbb, mathfrak,
and mathcal.

4. amsthm integrations and special environments for theorems, lemmas, proofs, defini-
tions, examples, and remarks.

5. Stylized support for the part environment.

6. A fullpage environment that spans across the text width and the margin for longer
equations and horizontal figures.

Each of these will be discussed in the following subsections.

fontenc
5 Included Packages mathrsfs
enumitem
Additional package are listed right under the required packages in NotesTeX.sty. These mathtools
are divided into font styling packages and mathematical and physics related packages. The amsfonts
list of packages are also reiterated here and their links are in the sidenotes. amsthm
bm
\usepackage[T1]{fontenc} % Font Styling array
tabularx
\usepackage{lmodern,mathrsfs}
booktabs
graphicx
\usepackage[shortlabels]{enumitem} % Enumitem Options float
caption
\usepackage{mathtools,amssymb,amsfonts,amsthm,bm} % Math Presets setspace
\usepackage{array,tabularx,booktabs} % Table Presets multicol
\usepackage{graphicx,wrapfig,float,caption} % Figure Presets tikz
\usepackage{setspace,multicol} % Text Presets physics
cancel
\usepackage{tikz,physics,cancel} % Physics Presets
Table 2. Links
2 Affectionately called NoTeX.

2
Margins 3

6 Margins
NotesTeX inherits all the margin commands that are used by sidenote and marginnote,
and two additional pre-configured commands known as \mn and \sn. The relevant com-
mands, and the packages they belong to, are

\marginfigure [sidenote] \margintable [sidenote]


\sidenote [sidenote] \sn [NotesTeX]
\marginnote [marginnote] \mn [NotesTeX]

The implementation of each of these is as follows.

1. Marginnote: This is how a \marginnote{...} behaves. Not numbered, 10pt.

2. Mn: This is how a \mn{...} behaves.1 1


Numbered, footnotesize.

3. Sidenote: This is how a \sidenote{...} behaves.2 2


Numbered, 10pt.

4. Sn: This is how a \sn{...} behaves.3 3


Numbered, footnotesize.

5. Marginfigure: This environment requires the \begin{marginfigure} · · · 1 4


\end{marginfigure} enclosings. The caption package is needed to caption the
figure.

6. Margintable: This environment requires the \begin{margintable} · · ·


\end{margintable} enclosings. A table package, such as tabular, tabulary, tabu, 2 3
or tabularx is required. The caption package is needed to caption the table.

6.1 Why use both marginnotes and sidenotes? Figure 1. Marginfigure: Tikz

Quite simply, marginnotes overlap each other if they are too close. This means that NotesTeX rocks!
figures, and tables can overlap by just using marginnotes. This is why sidenotes is so
useful as it not only numbers all side notes, but also dynamically aligns all side notes, Table 3. Margintable
figures, and tables.
So clearly, sidenotes must be better right? There are a few places where sidenotes
fails too however. For instance, sidenotes cannot be used in equations, multicols, and
with the tcolorbox4 environment. As the majority of the special environments from 4
See 8 and 10 for more details.
amsthm are modified to use tcolorbox, marginnotes becomes an essential part of Notes-
TeX.
TEX Shortcuts 4

7 TEX Shortcuts
NotesTeX comes built in with a minimal set of keyboard shortcuts for a few special char-
acters. All of these shortcuts can be found in NotesTeX.sty just under

% ----------------------------------------------------------------------
% User Created Commands
% ----------------------------------------------------------------------
...

If one has their own macros,5 then simply add it under this area. 5
Most people have their own short-
cuts for commonly used mathemat-
ics, such as derivatives or integrals.
7.1 Available Shortcuts
For those looking for some physics
To keep things light, NotesTeX offers the following simplifications/shortcuts to the math- shortcuts, the supremely excellent
physics package (automatically in-
ematics dictionary.
cluded in NotesTeX) has possible ev-
erything that one can imagine.
1. Vector Bold Math: The shortcut {\bf ·} −→ \bf· creates boldface text. For example,
{\bf a} becomes \bfa producing the output a. This works for both upper and lower
case alphabet.

2. Mathfrak: The \mathfrak environment is quite similar to the Vector Bold Math in
the shortcut argument, \mathfrak{·} −→ \mf·. This works for both upper and lower
case producing

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ

3. Mathbb: All \mathbb{·} objects are turned into \bb{·}. This only works for uppercase
alphabet.
ABCDEFGHIJKLMNOPQRSTUVWXYZ

4. Mathcal: All \mathcal{·} objects are turned into \mc{·}. This only works for
uppercase alphabet.

ABCDEFGHIJ KLMN OPQRST UVWX YZ


amsthm Environments 5

8 amsthm Environments
amsthm environments are defined as usual being enclosed by \begin{environment}· · ·
\end{environment} and most have been modified ostensibly from the original amsthm
presets. Primarily, most environments, with the exception of the exercise environment,
are now integrated with the wonderful tcolorbox package. Note that the counting for
theorems and lemmas is distinct from the counting for definitions. Also note that the
breakable for tcolorbox allows these environments to span multiple pages.

Definition 8.1. The definition environment and the associated tcolorbox are pro-
vided by the following code in NotesTeX.sty:

\tcolorboxenvironment{definition}{
boxrule=0pt,
boxsep=0pt,
colback={White!90!Cerulean},
enhanced jigsaw,
borderline west={2pt}{0pt}{Cerulean},
sharp corners,
before skip=10pt,
after skip=10pt,
breakable,
}

Theorem 8.1. The theorem environment and the associated tcolorbox are provided
by the following code in NotesTeX.sty:

\tcolorboxenvironment{theorem}{
boxrule=0pt,
boxsep=0pt,
colback={White!90!Dandelion},
enhanced jigsaw,
borderline west={2pt}{0pt}{Dandelion},
sharp corners,
before skip=10pt,
after skip=10pt,
breakable,
}

Lemma 8.2. The lemma environment and the associated tcolorbox are provided by
the following code in NotesTeX.sty:

\tcolorboxenvironment{lemma}{
boxrule=0pt,
boxsep=0pt,
blanker,
borderline west={2pt}{0pt}{Red},
before skip=10pt,
after skip=10pt,
sharp corners,
left=12pt,
amsthm Environments 6

right=12pt,
breakable,
}
Proof. The proof environment and the associated tcolorbox are provided by the
following code in NotesTeX.sty:

\tcolorboxenvironment{proof}{
boxrule=0pt,
boxsep=0pt,
blanker,
borderline west={2pt}{0pt}{NavyBlue!80!white},
before skip=10pt,
after skip=10pt,
left=12pt,
right=12pt,
breakable,
}

Example. The example environment and the associated tcolorbox are provided by
the following code in NotesTeX.sty:

\tcolorboxenvironment{example}{
boxrule=0pt,
boxsep=0pt,
blanker,
borderline west={2pt}{0pt}{Black},
sharp corners,
before skip=10pt,
after skip=10pt,
left=12pt,
right=12pt,
breakable,
}
Remark. The remark environment and the associated tcolorbox are provided by the
following code in NotesTeX.sty:

\tcolorboxenvironment{remark}{
boxrule=0pt,
boxsep=0pt,
blanker,
borderline west={2pt}{0pt}{Green},
before skip=10pt,
after skip=10pt,
left=12pt,
right=12pt,
breakable,
}
Exercise. The exercise environment remains unchanged from the amsthm presets.
The Part Environment tcolorbox Environment and Known Issues 7

8.1 tcolorbox Environment and Known Issues


There is one issue with this however. Since we are using a tcolorbox, this proof environ- Not a major one but frustrating
ment is incompatible with \sn and \sidenote, as it results in a Float(s) Error. However, nonetheless.
this environment is compatible with \mn and \marginnote thankfully.6 6
As one can see right here.
The breakable should allow the proof environment to span multiple pages. If one
wishes to change the color, simply modify the line which states borderline west={1pt}{0pt}{blue}.
The first numeric value dictates the width of the line, the second dictates how close it is
away from the left margin, while the last argument obviously dictates the color. This code
could also be used to change any of the other amsthm environments.

9 The Part Environment


In the original Jhep format, the \part environment is not special and is set to the default
given by the article class. In NotesTeX, the part environment produces the following im-
age. Furthermore the code responsible is noted below.

PART

\titleformat{\part}[hang]{{\thispagestyle{plain}}\Huge\bfseries}{\marginnote{
\begin{tcolorbox}
[width=\marginparwidth,height=\marginparwidth/2,colback=black!75!white,
colframe=black!75!white,center title,fonttitle=\bfseries\normalsize,title=PART,
text fill]

\begin{center}
{\color{white}\thepart}
\end{center}

\end{tcolorbox}
}[-1.25in]}{0pt}{\Huge\bfseries}

This combines the titlesec and the tcolorbox packages, placing the title of the
\part on the left hand side, and the \part number in the margin. It is recommended that
one do not mess with this, other than changing the colors given by colback and colframe.
Fullpage Environment 8

10 Fullpage Environment

The fullpage environment is defined by

\begin{fullpage}
···
\end{fullpage}

with the with of the fullpage environment given by \textwidth+\marginparsep+\marginparwidth.

There are some clear benefits of having use of the full page at times. Suppose that one
wants to place a figure that cannot fit into the margins, or if an equation is quite long
and it bleeds into the margin, then the fullpage environment can both clearly separate
these from the surrounding text and allot for the dimensions without hassle. The code in
NotesTeX.sty that is responsible for the fullpage environment is given by7 7
This is also an example of why the
fullpage environment is nice.

\newenvironment{fullpage}{
{\smallskip\noindent
\begin{minipage}{\textwidth+\marginparwidth+\marginparsep}\hrule\smallskip\smallskip}
{\smallskip\smallskip\hrule\end{minipage}\vspace{.1in}
}

Remark. If one do not like the lines at the beginning and end of the fullpage envi-
ronment, simply remove all the \hrule that is in the code. Similarly, it is possible to
change the vertical spacing after the fullpage is over, by modifying the \vspace{}
argument.

A major benefit of having a fullpage is the ability to use This would be especially useful for formatting exercises in
multicols to its fullest extent. For example, these empty sen- multiple columns and it makes the text distinct from the rest
tences are an example of how effective the multicols package of the fullpage environment. The author has run out of
can be inside of the fullpage environment. things to say.

10.1 Known Issues with Fullpage


There are a few issues with the fullpage however.
Remark. Since the fullpage environment uses a minipage, and minipages do not
work over multiple pages, one will need a new fullpage per page.
Remark. Also, please note marginnote, or sidenotes cannot be used in this
environment. Footnotes, on the other hand, can be used but are really ugly.
PART

Advanced Page Formatting III


For those wanting to adjust the margin sizes, or the fancyhdr layout, there are a few
comments that could be made here.

11 Page Dimensions
NotesTeX relies on the geometry package to set its dimensions. The associated code is the
deceptively simple chunk of code given by

\geometry{paperheight=845pt,paperwidth=597pt,
marginparsep=.02\paperwidth,marginparwidth=.23\paperwidth,
hoffset=-1in, voffset=-1in, headheight=.02\paperheight,
headsep=.03\paperheight,footskip=20pt,
textheight=.84\paperheight,textwidth=.64\paperwidth}.

Ignoring most of the arguments, the \paperheight and \paperwidth are set to be the
standard 8 × 11 inches but in pt format instead. All other options, with the exception of
\hoffset and \voffset, inherit fractions of \paperheight and \paperwidth, the most im-
portant being \marginparwidth. Increasing \marginparwidth causes the margin to bleed
off of the right side of the page. In order to increase, one must decrease the \textwidth
accordingly.

12 Fancyhdr Layout
As mentioned before, fancyhdr is overridden on the title page, the contents page, and the
\part page, and sets the header for all other pages through the code

\pagestyle{fancy}%
\newlength{\offset}%
\setlength{\offset}{\marginparwidth + \marginparsep}%
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}%
\renewcommand{\subsectionmark}[1]{\markright{#1}{}}%

\fancypagestyle{fancynotes}{%
\fancyhf{}%
\fancyheadoffset[rh]{\offset}%
\renewcommand{\headrulewidth}{0pt}%
\fancyhead[L]{\textsc{\leftmark}}%
\fancyhead[R]{\footnotesize \textit{\rightmark}~~~~ \thepage}%
}%

The header style is set so that it spans the width of the entire page as opposed to just the
\textwidth through the line \fancyheadoffset[rh]{\myoddoffset}. The \sectionmark
and \subsectionmark are set up so that the section appears on the left and all subsections
appear on the right along with the page number, and this is given in the last two lines of
code.

You might also like