The following code defines a header with a logo, a course title, an quiz title, and boxes for the student to enter in their name, id and section.
I will comment out the image since it works and does not affect the answer. How does "quiz title" end up below the horizontal line?
\documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage{calc} \usepackage{amsmath} \usepackage{multirow} \usepackage{graphicx} \NewDocumentCommand{\ans}{O{} O{36}}{% \fbox{\makebox(#2 pt,18pt){}} } % Define the quiz environment \newenvironment{quiz}[2][]{% \begin{flushleft} \begin{tabular}{cccccc} \multirow{2}{*}{ %\includegraphics[width=40pt]{rulogo.png} } & & & \small{Name} & \small{NetID} & \small{Section} \\ & #1 & #2 & \ans[][162] & \ans[][50] & \ans \\ \end{tabular} \end{flushleft} \hrule }{% } \begin{document} \begin{quiz}{mycourse}{quiz title} \end{quiz} \end{document} The same thing happens if I just create a single line of output. I could understand if the line overflowed and the last item spilled onto the next line, but how does #2 jump out of the middle?
\begin{flushleft} \includegraphics[width=1cm]{logo.png} #1 #2 \ans[][144] \ans[][50] \ans \\ \end{flushleft} 
\small Namenot\small{Name}\ansdefined with an optional argument that is never used?