Skip to main content

CopyPasta

\documentclass[twoside,12pt]{article}

% Set some margins (columnsep is used just for 2-col layouts) and
% the paper size.
\usepackage[letterpaper, margin=1in, columnsep=0.5in]{geometry}

% Set up fonts. Use the Bembo-for-poor-people typeface for text, Libertine
% for Math equations. Note the number styling.
\usepackage[T1]{fontenc}
\usepackage[expansion=false]{microtype}
\usepackage[p,osf]{fbb}
\usepackage{libertinust1math}
\usepackage{amsmath, amsfonts, amsthm}

% Other packages
\usepackage[hang,flushmargin]{footmisc}
\usepackage[labelfont=bf, textfont=it]{caption}
\usepackage{adjustbox}
\usepackage{blindtext}
\usepackage{color,soul}
\usepackage{float}
\usepackage{framed}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{multicol}
\usepackage{needspace}
\usepackage{tikz}
\usepackage{xfp}
\usepackage{unicodenewchar}

% References. Managed by BibLaTeX with Biber as the backend for APA, MLA, etc.
% Hyperref will make the citations clickable.
\usepackage[style=alphabetic,backend=biber]{biblatex}

% =============================================================

% Patch Tabular to use monospaced font for the tables
\AtBeginEnvironment{tabular}{\sffamily}

% Add circles to things. Good for inline lists. \circled{1}, for example.
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=1pt] (char) {#1};}}

% Caption setup. Make the labels smallcaps and bold. Make the entire font size
% smaller. Rename the figure and table names.
\captionsetup{
labelfont={bf,small,sc},
textfont=small,
labelsep=period,
figurename=FIGURE,
tablename=TABLE
}

% Set some margins, set the typeface, do not indent paragraphs,
% adjust paragraph line heights.
\setlength{\parindent}{0em}
\setlength{\parskip}{0.75em}

% Customize footnotes
\setlength{\footnotesep}{\baselineskip}
\setlength{\footnotemargin}{0.75em}
\setlength{\skip\footins}{1em}

% Independent sign
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}}
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}

% Header and footer
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\color{lightgray}\fontsize{8pt}{1em}\selectfont\uppercase{Clinical Epidemiology}}
\fancyhead[C]{\color{lightgray}\fontsize{8pt}{1em}\selectfont{Fall 2025}}
\fancyhead[R]{\color{lightgray}\fontsize{8pt}{1em}\selectfont\thepage}
% \fancyfoot[R]{\color{lightgray}\fontsize{8pt}{1em}\selectfont\thepage}
\renewcommand{\headrulewidth}{0pt}

% Add bibliography. We need that newunicodechar declaration to make
% \printbibliography work (for some reason).
\addbibresource{References.bib}
\newunicodechar{}{\thinspace}

% =============================================================

\begin{document}
\raggedbottom

\begin{center}
{\LARGE \textbf{Hello World!}}\\[0.75em]
{\large Nikhil Anand (\texttt{NA3213})}\\[0.5em]
{\small Submitted \today}\\[0.5em]
\end{center}

\vspace{0.125em}
\noindent\rule{\columnwidth}{0.25pt}
\vspace{0.0625em}

% =============================================================

% Here be content... Here's some Lipsum
\blindtext\blindtext

% =============================================================

\printbibliography

\end{document}

Other Stuff

Equations

Refer to Equations with \eqref{}

% Equation. Entire block numbered.
\begin{equation}
\begin{aligned}
E & = mc^2 \\
\implies E & = \sum_{x=2}^{\infty}\frac{y^x}{x!} \\
F & = ma \\
F & = ma \\
\end{aligned}
\end{equation}

% Equation. Selective labeling.
\begin{align}
E & = mc^2 \label{eq:einstein} \\
F & = ma \nonumber \\
pV & = nRT \label{eq:ideal_gas}
\end{align}

Tables

Refer to tables with \ref{}

% Tables
\begin{table}[h!]
\centering
\begin{tabular}{|l c |r|}
\hline
Constant & Symbol & Value \\
\hline
Speed of light & $c$ & $3.00 \times 10^8 \,\text{m/s}$ \\
Gravitational constant & $G$ & $6.67 \times 10^{-11} \,\text{N m}^2/\text{kg}^2$ \\
Planck constant & $h$ & $6.63 \times 10^{-34} \,\text{J s}$ \\
\hline
\end{tabular}
% Label should go right after Caption!
\caption{Physical constants used in the experiments}
\label{tab:constants}
\end{table}

Images/Figures

\begin{figure}[H]
\centering
\includegraphics[width=0.95\textwidth]{km.png}
\caption{\small Kaplan-Meier Curve showing the Cumulative Probability of Death in Control and Treatment Groups}
\label{fig:km1}
\end{figure}

Live Math

\fpeval{round(exp(-0.997), 3)}
\def\radius{5}
\def\area{\fpeval{pi * \radius^2}}
\def\diameter{\fpeval{2 * \radius}}
Diameter is \diameter

Colors

% Define a custom color anywhere and use it.
\definecolor{mygreen}{HTML}{3FA722}
\textcolor{mygreen}{Lolzilla!}
% Or use a standard color:
% black, blue, brown, cyan, darkgray, gray, green, lightgray, lime,
% magenta, olive, orange, pink, purple, red, teal, violet, white, yellow
\textcolor{pink}{Pretty pretty pink}

Typefaces

% Use Libertine for both text and equations. Note the packages required above.
\usepackage[T1]{fontenc}
\usepackage{libertinus}
\usepackage{libertinust1math}

% Use the sans-serif variant of a typeface.
\renewcommand{\familydefault}{\sfdefault}

Boxes

% Put a nice box around something
\begin{framed}
\blindtext
\end{framed}

Double Spacing

\usepackage{setspace}

\begin{document}
\doublespacing
\end{document}

Text Highlighting

\usepackage{color,soul}

\hl{foo}
\hl{\textbf{foo}}
\textcolor{red}{foo}
\textbf{\textcolor{red}{\hl{foo}}}
\textcolor{red}{\textbf{\hl{foo}}}

Multiple Columns

Use multicol for more flexibility. Showing with lipsum text from blindtext. Note that multicol* means that it won't balance content across columns.

\usepackage{blindtext}

\begin{multicols*}{2}
\raggedcolumns
\blindtext\blindtext
\end{multicols*}

If you see the package pushing things around, try this before some block:

\needspace{8\baselineskip}
\begin{framed}
"My mama always said life was like a box of chocolates. You never know what you're gonna get."
\\\\
-- \small{Forrest Gump}
\end{framed}