Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
% Written HW (Questions & Answers) Template
% - Created by Walter Macfarland
% A few abbreviations used throughout this template:
% Q - Question
% A - Answer
% N - Question Number
\documentclass[12pt]{article}
\usepackage{fullpage}
\usepackage{changepage}
\renewcommand{\familydefault}{\sfdefault}
\sloppy{}
% Let \indentlen{} be a macro for the length to indent Q/A text.
\newcommand{\indentlen}{2.5em}
%
% Print out N + Q + A
%
% - Usage: \printQA{Question#}{Question}{Answer}
%
\newcommand{\printNQA}[3]{
\subsection*{#1}
\begin{minipage}{\textwidth}
\vspace{0.25cm}
\begin{adjustwidth}{\indentlen{}}{0em}
\textbf{Question: }#2
\vspace{0.2cm}
\par \textbf{Response: }#3
\end{adjustwidth}
\end{minipage}}
% Print out N + A
\newcommand{\printNA}[2]{
\subsection*{#1}
\begin{minipage}{\textwidth}
\vspace{0.25cm}
\begin{adjustwidth}{\indentlen{}}{0em}
#2
\end{adjustwidth}
\end{minipage}}
\begin{document}
\title{Homework}
\author{Author}
\maketitle
\section*{Questions \& Answers}
\bigskip{}
% Begin Q/A
% Placeholder to show usage
\printNQA
{1)}
{Question text}
{Answer text}
\printNA
{2)}
{Answer text}
\printNA
{3)}
{Answer text}
% END Q/A
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment