LaTeX nerd LaTeX blog

LaTeX Lecture Notes Template follow up

Based on the framework previously, some significant changes have been applied. Here are some highlights.

Cover page

The cover page, or the title page is from latextemplate. Moreover, as the curly braces do not scale as the title, I change a bit to make it “responsive”:

% Set the width of the curly brackets above and below the titles
\setlength{\unitlength}{0.36\textwidth} 

% Top curly bracket
{\color{ashgrey}\resizebox*{\maxof{
  \widthof{\Huge\courtitle}}{\unitlength}}
  {\baselineskip}{\rotatebox{90}{$\}$}}}
  \\[\baselineskip] 

% Title
\textcolor{RoyalRed}{\textit{\Huge \sffamily \courtitle}}
\\[\baselineskip] 

% Subtitle or further description
{\color{rosybrown}\Large \sffamily \cournum}\\ 

% Bottom curly bracket
{\color{ashgrey}\resizebox*{
  \maxof{\widthof{\Huge\courtitle}}{\unitlength}}
  {\baselineskip}{\rotatebox{-90}{$\}$}}} 

and these commands are from calc package.

Font

I adopted the font from here. Then the font is quite like the textbook version. The code is as follows:

\usepackage[osf,sc]{mathpazo}
\usepackage[scaled=0.8]{beramono}
\linespread{1.15}
\renewcommand{\sfdefault}{iwona}

The numbers in non-math mode are like Georgia font, which is non-lining. I believe you can fix this by some tricks, but this can distinguish math numbers and text numbers.

Another thing to note is that these two packages do not compile in luatex (at least I just compile simply). Preferably, this font can be compiled under pdflatex.

These two packages change the typewriter font (texttt), or the texttt font does not look good with this font. Therefore, I found two typewriter fonts look good with beramono:

  • \usepackage[zerostyle=d]{newtxtt}: which I widely use over lots of courses.
  • \usepackage[scale=0.9]{sourcecodepro}: which I use for courses with lots of source code, e.g., CS 146.

Environment change

I ask several friends on the “unboxed” environments, like note, remark, they all said it’s bit awkward to put the title outside the left vertical line. Thus, the change is as follows:

\newenvironment{note}{
	%{\par \textbf{\sffamily Note}}
	\tcolorbox[blanker,breakable,left=5mm,
	before skip=10pt,after skip=10pt, parbox=false,
	borderline west={1mm}{0pt}{black},
	title={\textbf{\sffamily\color{black}Note:}}
	]
}
{\endtcolorbox}

\newenvironment{remark}{
	%{\par \calligra \color{mypink} Remark:}
	\tcolorbox[blanker,breakable,left=5mm,
	before skip=10pt,after skip=10pt, parbox=false,
	borderline west={1mm}{0pt}{mypink},
	title={\sf\color{mypink}Remark:}]
}
{\endtcolorbox}

\newenvironment{ex}[1][]{
	%{\par \calligra \color{blue} Example:} {\bfseries #1}
	\tcolorbox[blanker,breakable,left=5mm,
	before skip=10pt,after skip=10pt,parbox=false,
	borderline west={1mm}{0pt}{blue},
	title={\sf\color{blue}Example: #1}]
}
{\endtcolorbox }

Similar to other environments.

Part epigraph

Somehow I am not satisfied with default part front page. Thus I changed a bit from this solution and add pictures:

\makeatletter
\titleformat{\part}[display]
{\Huge\scshape\filright}
{
\begin{center}\includegraphics[width=0.2\linewidth]{pic\thepart}
\end{center}
\partname~\thepart:}
{20pt}
{\thispagestyle{epigraph}}
\makeatother
\setlength\epigraphwidth{.6\textwidth}

So for part 1, one must have picI.png. And to use it in the main body, one can use

\newpage % to prevent some text overflow/underflow
\epigraphhead[450]{your epigraph}
\part{Part name}

And one can change 450 to adjust the position of epigraph.

Pikachu

Originally I saw it from latexstudio, and the original source is hatenablog. However, it does not have colors. Thus I add color to original code:

\definecolor{pik}{HTML}{FAD61D}
\tcbset{pikachu/.style={enhanced,colback=pik,colframe=black,boxrule=0.6mm,enlarge top by=7.0mm,enlarge bottom by=2.0mm,top=50pt,sharp corners=south,arc=14mm,
	grow to left by=-1cm,
overlay={
\begin{scope}[shift={([xshift=9.0mm,yshift=-13mm]frame.north west)},rotate=30]
% 左目
  \path[draw=black,fill=black,line width=0.5mm] (0,0) arc (0:360:2mm);
  \path[fill=white] (-.05,.08) arc (0:360:1mm);
% 右目
  \path[draw=black,fill=black,line width=0.5mm] (1.2,0) arc (0:360:2mm);
  \path[fill=white] (1.1-.05,.08) arc (0:360:1mm);
% ハナ
  \path[draw=black,fill=black] (0.4,-.15) circle [x radius=0.06,y radius=0.03] (0:360);
% クチ
  \path[draw=black,line width=0.4mm,xshift=0.5mm,yshift=-3.5mm] (0,-.02) .. controls (.1,-.1) and (.15,-.14) .. (.35,0) % 左
  .. controls (-.15+.7,-.14) and (-.1+.7,-.1) .. (0+.7,-.02); % 右
% ほっぺ
  \path[draw=black,fill=pik,line width=0.4mm] (1.6,-0.4) arc (10:290:2mm);
\end{scope}}
,
underlay={
\begin{scope}[shift={([xshift=0mm,yshift=0mm]frame.north west)}]
% 耳とフレームが重なるところを白塗り(右)
  \path[draw=white,line width=0.7mm] (1.51,-0.03)--(2.55,-0.03);
% 耳とフレームが重なるところを白塗り(左)
  \path[draw=pik,line width=2.0mm] (0.1,-1)--(0.1,-2);
\end{scope}}
,
% 右耳
underlay={
\begin{scope}[shift={([xshift=0mm,yshift=0mm]frame.north west)}]
% 耳のメイン
  \path[draw=black,fill=pik,line width=0.6mm,rounded corners=1.0pt] (1.5,-0.03) .. controls (2.5,0.3) and (3.5,-0.5) .. (3.7,-0.6) .. controls (2.7,-0.5) and (2.5,-0.5) .. (2.2,-0.4);

% 耳の黒い部分の境界
  \clip (1.5,-0.03) .. controls (2.5,0.3) and (3.5,-0.5) .. (3.7,-0.6) .. controls (2.7,-0.5) and (2.5,-0.5) .. (2.2,-0.4);

  \fill[black] (2.4,-0.5) to [out=10,in=210] (3.4,-0.3) -- (4,-0.7) -- cycle;
\end{scope}}
,
% 左耳
underlay={
\begin{scope}[shift={([xshift=9.06mm,yshift=4.93mm]frame.north west)},rotate=60]
% 耳のメイン xscale=-1 で反転
  \path[xscale=-1,draw=black,fill=pik,line width=0.6mm,rounded corners=1.0pt] (1.5,-0.03) .. controls (2.5,0.3) and (3.5,-0.5) .. (3.7,-0.6) .. controls (2.7,-0.5) and (2.5,-0.5) .. (2.2,-0.4);

% 耳の黒い部分の境界
  \clip[xscale=-1] (1.5,-0.03) .. controls (2.5,0.3) and (3.5,-0.5) .. (3.7,-0.6) .. controls (2.7,-0.5) and (2.5,-0.5) .. (2.2,-0.4);

  \fill[xscale=-1,black] (2.4,-0.5) to [out=10,in=210] (3.4,-0.3) -- (4,-0.7) -- cycle;
\end{scope}}
,
% しっぽ
underlay={
\begin{scope}
[xscale=1.1,yscale=0.4,shift={([xshift=-5mm,yshift=-19mm]frame.north east)},rotate=38]
% [xscale=1,yscale=1,shift={([xshift=-8mm,yshift=-50mm]frame.north east)},rotate=0]
% グリッド
% \draw [help lines] (-6,0) grid (6,6);
  \path[draw=black,fill=pik,line width=0.6mm,rounded corners=1.0pt]
    (0,0) -- (0.3,0) -- (0.7,1.2) -- (-0.5,1.4) -- (-0.1,2.7) -- (-1.8,3) to [out=80,in=245] (-1,5.4) -- (-3.9,6) to [out=245,in=90] (-4.6,2.2) -- (-2,2) -- (-2.2,1.1) -- (0.2,0.7) -- cycle;

% 上とおなじの clip
  \clip (0,0) -- (0.3,0) -- (0.7,1.2) -- (-0.5,1.4) -- (-0.1,2.7) -- (-2,3) to [out=80,in=245] (-1.2,5.4) -- (-4.1,6) to [out=245,in=90] (-4.8,2.2) -- (-2.2,2) -- (-2.5,1.1) -- (0.2,0.7) -- cycle;
  \fill (-0.8,0.7) -- (-0.2,0.9) -- (-0.5,1.1) -- (-0.2,1.1) -- (-0.4,1.2) -- (-0.1,1.25) -- (-0.4,1.45)
    -- (1,1.5) -- (1,0) -- (-0.5,0) -- cycle;
\end{scope}}
,
% 背中の模様
underlay={
\begin{scope}[shift={(frame.north west)},rounded corners=10pt]
\path[fill=black,xshift=36mm,yshift=0mm] (0,0) -- (0.3,-0.8) -- (0.35,0);
\path[fill=black,xshift=42mm,yshift=0mm] (0,0) -- (0.3,-0.8) -- (0.35,0);
\end{scope}}
}}

I have used it in CS 479 and PMATH 347.

Meta data

To have meta data for pdf, one can use

\hypersetup{pdfinfo={
    Title={\cournum~-~\courtitle},
    Author={Me},
    Subject={University of Waterloo, \cournum, \term},
    Keywords={\courtitle}
}}

and there might some other options.

Other

  • halloweenmath has many interesting symbols.
  • and to be updated.