-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.tex
More file actions
54 lines (51 loc) · 1.94 KB
/
utils.tex
File metadata and controls
54 lines (51 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% utils.tex - A LaTeX file that contains commonly used commands and other
% miscellaneous things.
% Author: Evan Carmi http://ecarmi.org/
% Usage: to include this file in another .tex file add:
% \input{/path/to/utils.tex}
% to the preamble of that document.
% Create a horizontal rule across the page.
\newcommand{\HRule}{\noindent\rule{\linewidth}{.5mm}\\}
\newcommand{\hwheader}[1]{\begin{center}
% Define command to create a custom header for homework assignments which
% automatically includes the date.
% Example Usage: \hwheader{Comp 312: Algorithms and Complexity\\Assignment 1}}
% Based off a header by Matt Adelman.
\textbf{ Evan Carmi\\
#1\\
\today
} \end{center}
\HRule
}
\newcommand{\register}[1]{
% Create a register through a table:
% Example Usage: \register{1 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 1 & 0 \\}
% LaTeX ignores extra columns, so support up to 64-bit registers
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
#1 \\
\hline
\end{tabular}
\end{center}
}
\newcommand{\registerb}[1]{
% Create a register through a table with each 4 bits separated:
% Example Usage: \register{1 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 1 & 0 \\}
% LaTeX ignores extra columns, so supports up to 64-bit registers
\begin{center}
\begin{tabular}{|c|c|c|c || c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c||c|c|c|c|}
\hline
#1 \\
\hline
\end{tabular}
\end{center}
}
\newcommand{\problem}[1]{
% Create a problem - solution prompt.
% Param 1: The text of the problem, which will be prefixed with Problem:.
% Solution: will be appended to text.
% Example Usage: \problem{What's 2+2}2+2 is 5.
\textbf{Problem:} #1\\
\textbf{Solution:}
}