15

I have been losing sleep lately as to how to make the most professional looking problem set (math and physics oriented) that is both easy to read and concise (i.e. no title pages), and yet is beautiful/elegant and has a good sense of style and professionalism (i.e. it looks like it could be from one of those great books Springer Graduate Texts).

Here is my latest shot at this.

Template for a Waves Class

Source:

% ***********************************************************
% ******************* PHYSICS HEADER ************************
% ***********************************************************
% Version 2
\documentclass[12pt]{article}
\usepackage{amsmath} % AMS Math Package
\usepackage{amsthm} % Theorem Formatting
\usepackage{amssymb}    % Math symbols such as \mathbb
\usepackage{graphicx} % Allows for eps images
\usepackage[dvips,letterpaper,margin=1in,bottom=0.7in]{geometry}
\usepackage{tensor}
 % Sets margins and page size
\usepackage{amsmath}

\renewcommand{\labelenumi}{(\alph{enumi})} % Use letters for enumerate
% \DeclareMathOperator{\Sample}{Sample}
\let\vaccent=\v % rename builtin command \v{} to \vaccent{}
\usepackage{enumerate}
\renewcommand{\v}[1]{\ensuremath{\mathbf{#1}}} % for vectors
\newcommand{\gv}[1]{\ensuremath{\mbox{\boldmath$ #1 $}}} 
% for vectors of Greek letters
\newcommand{\uv}[1]{\ensuremath{\mathbf{\hat{#1}}}} % for unit vector
\newcommand{\abs}[1]{\left| #1 \right|} % for absolute value
\newcommand{\avg}[1]{\left< #1 \right>} % for average
\let\underdot=\d % rename builtin command \d{} to \underdot{}
\renewcommand{\d}[2]{\frac{d #1}{d #2}} % for derivatives
\newcommand{\dd}[2]{\frac{d^2 #1}{d #2^2}} % for double derivatives
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}} 
% for partial derivatives
\newcommand{\pdd}[2]{\frac{\partial^2 #1}{\partial #2^2}} 
% for double partial derivatives
\newcommand{\pdc}[3]{\left( \frac{\partial #1}{\partial #2}
 \right)_{#3}} % for thermodynamic partial derivatives
\newcommand{\ket}[1]{\left| #1 \right>} % for Dirac bras
\newcommand{\bra}[1]{\left< #1 \right|} % for Dirac kets
\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right|
 \left. #2 \vphantom{#1} \right>} % for Dirac brackets
\newcommand{\matrixel}[3]{\left< #1 \vphantom{#2#3} \right|
 #2 \left| #3 \vphantom{#1#2} \right>} % for Dirac matrix elements
\newcommand{\grad}[1]{\gv{\nabla} #1} % for gradient
\let\divsymb=\div % rename builtin command \div to \divsymb
\renewcommand{\div}[1]{\gv{\nabla} \cdot \v{#1}} % for divergence
\newcommand{\curl}[1]{\gv{\nabla} \times \v{#1}} % for curl
\let\baraccent=\= % rename builtin command \= to \baraccent
\renewcommand{\=}[1]{\stackrel{#1}{=}} % for putting numbers above =
\providecommand{\wave}[1]{\v{\tilde{#1}}}
\providecommand{\fr}{\frac}
\providecommand{\RR}{\mathbb{R}}
\providecommand{\NN}{\mathbb{N}}
\providecommand{\seq}{\subseteq}
\providecommand{\e}{\epsilon}

\newtheorem{prop}{Proposition}
\newtheorem{thm}{Theorem}[section]
\newtheorem{axiom}{Axiom}[section]
\newtheorem{p}{Problem}[section]
\usepackage{cancel}
\newtheorem*{lem}{Lemma}
\theoremstyle{definition}
\newtheorem*{dfn}{Definition}
 \newenvironment{s}{%\small%
        \begin{trivlist} \item \textbf{Solution}. }{%
            \hspace*{\fill} $\blacksquare$\end{trivlist}}%
% ***********************************************************
% ********************** END HEADER *************************
% ***********************************************************

\begin{document}

{\noindent\Huge\bf  \\[0.5\baselineskip] {\fontfamily{cmr}\selectfont  Problem Set VIII}         }\\[2\baselineskip] % Title
{ {\bf \fontfamily{cmr}\selectfont Physics 15c}\\ {\textit{\fontfamily{cmr}\selectfont     November 7, 2013}}}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    {\large \textsc{david roberts}\footnote{With Elizabeth Petrik}} % Author name
\\[1.4\baselineskip] 



\section{Optical Activity and LCDs}
\emph{Some materials have a property called "optical activity,” that is, for circularly     polarized light, their index of refraction (and therefore their wavelength in the medium) depends on whether the light is right- or left-circularly polarized. The EM waves propagating in the $+\uv{z}$ direction inside such a medium can therefore be described by}
\[\v{E}(z,t)=E_L(\uv{x}+i\uv{y})e^{i(k_Lz-\omega t)} +E_R(\uv{x}-i\uv{y})e^{i(k_Rz-\omega t)}\tag{1}\]
\emph{where $E_L$, $E_R$, $k_L$, and $k_R$ are the amplitudes and wavenumbers of the left- and right-handed electric field components, and $\uv{x}$ and $\uv{y}$ are the unit vectors pointing in the $+\uv{x}$- and $+\uv{y}$-direction, respectively.}

\begin{p} Suppose that the incoming wave at $z = 0$ is linearly polarized in the x-direction, i.e.,
\[\v{E}(0,t) = E_0e^{-i\omega t}\uv{x} \tag{2}\]
Calculate $E_L$ and $E_R$.
\end{p}
\begin{s} We evaluate (1) at $z=0$ and set the resulting expression equal to (2), hereby     solving for  $E_L$ and $E_R$:
\begin{align*}
\v{E}(0,t)&=E_L(\uv{x}+i\uv{y})e^{-i\omega t)} +E_R(\uv{x}-i\uv{y})e^{-i\omega t}\tag{(1) with $z=0$}\\
&=[(E_L+E_R)\uv{x}+(E_L-E_R)i\uv{y})]e^{-i\omega t}=E_0e^{-i\omega t}\uv{x}
\end{align*}
\end{s}
\end{document}

A previous iteration: Template for a Waves Class

Source:

% ***********************************************************
% ******************* PHYSICS HEADER ************************
% ***********************************************************
% Version 2
\documentclass[11pt]{article}
\usepackage{amsmath} % AMS Math Package
\usepackage{amsthm} % Theorem Formatting
\usepackage{amssymb}    % Math symbols such as \mathbb
\usepackage{graphicx} % Allows for eps images
\usepackage[dvips,letterpaper,margin=1in,bottom=0.7in]{geometry}
\usepackage{tensor}
 % Sets margins and page size
\usepackage{amsmath}
\makeatletter % Need for anything that contains an @ command 
\renewcommand{\maketitle} % Redefine maketitle to conserve space
{ \begingroup \vskip 10pt \begin{center} \Huge {\bf \@title}
    \vskip 10pt \large \@author \hskip 20pt \@date \end{center}
  \vskip 10pt \endgroup \setcounter{footnote}{0} }
\makeatother % End of region containing @ commands
\renewcommand{\labelenumi}{(\alph{enumi})} % Use letters for enumerate
% \DeclareMathOperator{\Sample}{Sample}
\let\vaccent=\v % rename builtin command \v{} to \vaccent{}
\usepackage{enumerate}
\renewcommand{\v}[1]{\ensuremath{\mathbf{#1}}} % for vectors
\newcommand{\gv}[1]{\ensuremath{\mbox{\boldmath$ #1 $}}} 
% for vectors of Greek letters
\newcommand{\uv}[1]{\ensuremath{\mathbf{\hat{#1}}}} % for unit vector
\newcommand{\abs}[1]{\left| #1 \right|} % for absolute value
\newcommand{\avg}[1]{\left< #1 \right>} % for average
\let\underdot=\d % rename builtin command \d{} to \underdot{}
\renewcommand{\d}[2]{\frac{d #1}{d #2}} % for derivatives
\newcommand{\dd}[2]{\frac{d^2 #1}{d #2^2}} % for double derivatives
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}} 
% for partial derivatives
\newcommand{\pdd}[2]{\frac{\partial^2 #1}{\partial #2^2}} 
% for double partial derivatives
\newcommand{\pdc}[3]{\left( \frac{\partial #1}{\partial #2}
 \right)_{#3}} % for thermodynamic partial derivatives
\newcommand{\ket}[1]{\left| #1 \right>} % for Dirac bras
\newcommand{\bra}[1]{\left< #1 \right|} % for Dirac kets
\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right|
 \left. #2 \vphantom{#1} \right>} % for Dirac brackets
\newcommand{\matrixel}[3]{\left< #1 \vphantom{#2#3} \right|
 #2 \left| #3 \vphantom{#1#2} \right>} % for Dirac matrix elements
\newcommand{\grad}[1]{\gv{\nabla} #1} % for gradient
\let\divsymb=\div % rename builtin command \div to \divsymb
\renewcommand{\div}[1]{\gv{\nabla} \cdot \v{#1}} % for divergence
\newcommand{\curl}[1]{\gv{\nabla} \times \v{#1}} % for curl
\let\baraccent=\= % rename builtin command \= to \baraccent
\renewcommand{\=}[1]{\stackrel{#1}{=}} % for putting numbers above =
\providecommand{\wave}[1]{\v{\tilde{#1}}}
\providecommand{\fr}{\frac}
\providecommand{\RR}{\mathbb{R}}
\providecommand{\NN}{\mathbb{N}}
\providecommand{\seq}{\subseteq}
\providecommand{\e}{\epsilon}

\newtheorem{prop}{Proposition}
\newtheorem{thm}{Theorem}[section]
\newtheorem{axiom}{Axiom}[section]
\newtheorem{p}{Problem}[section]
\usepackage{cancel}
\newtheorem*{lem}{Lemma}
\theoremstyle{definition}
\newtheorem*{dfn}{Definition}
 \newenvironment{s}{%\small%
        \begin{trivlist} \item \textbf{Solution}. }{%
            \hspace*{\fill} $\blacksquare$\end{trivlist}}%
% ***********************************************************
% ********************** END HEADER *************************
% ***********************************************************

\begin{document}

\title{Physics 15c HW 4}
\author{David Roberts, with Nicki Charles}
\date{10/3/13}
\maketitle



\section{Optical Activity and LCDs}
Some materials have a property called "optical activity,” that is, for circularly     polarized light, their index of refraction (and therefore their wavelength in the medium) depends on whether the light is right- or left-circularly polarized. The EM waves propagating in the $+\uv{z}$ direction inside such a medium can therefore be described by
\[\v{E}(z,t)=E_L(\uv{x}+i\uv{y})e^{i(k_Lz-\omega t)} +E_R(\uv{x}-i\uv{y})e^{i(k_Rz-\omega t)}\tag{1}\]
where $E_L$, $E_R$, $k_L$, and $k_R$ are the amplitudes and wavenumbers of the left- and right-handed electric field components, and $\uv{x}$ and $\uv{y}$ are the unit vectors pointing in the $+\uv{x}$- and $+\uv{y}$-direction, respectively.

\begin{p} Suppose that the incoming wave at $z = 0$ is linearly polarized in the x-direction, i.e.,
\[\v{E}(0,t) = E_0e^{-i\omega t}\uv{x} \tag{2}\]
Calculate $E_L$ and $E_R$.
\end{p}
\begin{s} We evaluate (1) at $z=0$ and set the resulting expression equal to (2), hereby     solving for  $E_L$ and $E_R$:
\begin{align*}
\v{E}(0,t)&=E_L(\uv{x}+i\uv{y})e^{-i\omega t)} +E_R(\uv{x}-i\uv{y})e^{-i\omega t}\tag{(1) with $z=0$}\\
&=[(E_L+E_R)\uv{x}+(E_L-E_R)i\uv{y})]e^{-i\omega t}=E_0e^{-i\omega t}\uv{x}
\end{align*}
\end{s}
\end{document}

Please, guys, I'm more interested in what you all have settled on over the years. I need an influx of artistic ideas and therefore I call on the community to summon forth its best work.

I hope many will find this relevant.

Moriambar
  • 11,466
Dave
  • 255
  • I use amsart class to do this kind of job. – Sigur Nov 06 '13 at 20:23
  • This looks interesting. You should post your MWE that generates the screenshots you posted just share and maybe others will share as well. – azetina Nov 06 '13 at 20:26
  • 1
    Ok I'm doing that now... – Dave Nov 06 '13 at 20:26
  • Not sure, but as a grad student who has seen a ton of these, yours looks really, really slick. Nicely done! – jvriesem Nov 06 '13 at 20:45
  • Thanks a lot! - though if you have something cool too I'd like to see your ideas too! – Dave Nov 06 '13 at 20:46
  • In the first example, Some materials have a property called "optical activity,” has the second set of quotation marks getting swallowed by LaTeX. You need to use \ and '' to make them display properly. – alexwlchan Nov 06 '13 at 22:07
  • I mostly use my own skrapport document class, but the class itself is getting a bit out of hand. See 1, 2, 3 for samples of varying correctness. It automatically includes skmath, which provides useful math shorthands. – You Nov 07 '13 at 00:58

1 Answers1

5

This isn’t so much a cool new template, as a “grab bag” of suggestions for changes to the ones you’ve already written (which are a much better base to start from than pulling something out of thin air).

Fix the black squares at the end of solutions

One thing that both of your examples highlight is that when a solution ends on an equation or an align environment, there’s a newline between the final line and the black square. You’ll have the same problems if you have an itemize or an enumerate. Personally I think this looks a little ugly, so I’d like to fix it.

This is a problem that’s handled quite nicely by the proof environment in amsthm. It defines a command (\qedhere) that can be put at the end of an equation or a list, and removes the stray newline. To that end, I’d suggest the following definition of the s environment:

\renewcommand*{\qedsymbol}{$\blacksquare$}

\newenvironment{s}
  {\begin{proof}[Solution.]}
  {\end{proof}}  

This tells amsthm to use a black square at the end of proofs, and that the s environment is a proof, but renamed as “Solution”. You can then use \qedhere to move the black square up a line. (Or you could define a new command, say \endofsolution, which does the same thing but has a more accurate name.)

Use the commath package

I see that you've defined a bunch of commands for typesetting partial derivatives, mixed derivatives, and so on. Personally, I’d recommend using the commath package for this stuff: it defines some very flexible commands for typesetting derivatives and differentials, and it’s a lot more scalable than defining hundreds of commands.

For example, the commands you have here:

\renewcommand{\d}[2]{\frac{d #1}{d #2}} % for derivatives
\newcommand{\dd}[2]{\frac{d^2 #1}{d #2^2}} % for double derivatives
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
% for partial derivatives
\newcommand{\pdd}[2]{\frac{\partial^2 #1}{\partial #2^2}}
% for double partial derivatives

are covered by \od and \pd in commath, which have more ability to scale (if, for example, you wanted to typeset a kth order derivative). They also get the 'd's in ordinary derivatives to sit upright properly. *g*

Make a custom preamble

I’ve just finished writing some templates for this, but from the other side (I submit all of my work in LaTeX), so I have a file examples-sheets.tex which I \input at the top of every document. This has stuff like the date, my name and the format of my heading baked in as a custom command.

(See When should I use \input vs. \include? if you’re doing this).

This means the individual documents have a much simpler structure, and if I want to change parts (such as after asking a question on TeX.sx ;-)), I only need to change it once. This is what a typical document looks like:

\documentclass{article}

\usepackage{awlc-examples-sheets}

\begin{document}

% Course name, supervisor and sheet number/name
\ExamplesSheetTitle{Number Theory}{Dr.~J.~Smith}{Problem sheet 2}

\question

This is my answer to question 1.

\question

I wasn't sure about this question.

And so on.

\end{document}

I think that’s so much simpler.

In your example, you might change the course name, sheet name, and anybody you’re working with, but the basic structure stays the same. You could have a command like

\newcommand{\SheetTitle}[4]{
  {\noindent\Huge\bf  \\[0.5\baselineskip] {\fontfamily{cmr}\selectfont  Problem Set #2}}\\[2\baselineskip] %     Title
  { {\bf \fontfamily{cmr}\selectfont #1}\\ {\textit{\fontfamily{cmr}\selectfont \today}}}    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      {\large \textsc{david roberts}\footnote{With #3}} % Author name
  \\[1.4\baselineskip]}

and then in the top of a sheet you just add

\SheetTitle{Physics 15c}{VIII}{Elizabeth Petrik}

If you use the name of the sheet in headers or footers, then you could use this command to fill that in, too.


PS To answer the actual question (“anyone have any templates?”), the source code for my templates is on my GitHub page. The PDF in that folder has some explanations for the shortcuts I use in problem sheets (awlc-tripos). </plug>

PPS You’re loading amsmath twice. Why? :-P

alexwlchan
  • 5,417