# How could I print the table on the left of the page

I want to make a math exam paper via exam package but with the information of students on the left of the first page. We may deal with this by rotated line. However, it is the table I have to print. By the way, there is some error if I use table enviorment in the minipage enviorment. This is what I supposed to achieve by office.

Here is the code without the exam package.

\documentclass{article}
\usepackage{lipsum,tikz}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\node [xshift=2cm,yshift=-1.5cm] at (current page.north west) (topleft){};
\node [xshift=2cm,yshift=1.5cm] at (current page.south west) (bottomleft){};
\draw [->] (topleft.south) -- (bottomleft.north);
\end{tikzpicture}

\begin{table}[htbp]
\centering
\caption{mytable}
\begin{tabular}{|c|}
\hline
name\\
\hline
\\
\hline
id\\
\hline
\\
\hline
subject\\
\hline
\\
\hline
\end{tabular}
\end{table}

\lipsum[1-7]

\end{document}

• I would remove the \centering command and and load the caption package for not centring the caption, with \captionsetup{singlelinecheck=false} – Bernard May 25 '19 at 9:11
• I add the caption table and delete \centering command, but the table is still on the right of the vertical line. – Brooks May 25 '19 at 9:14
• Why have you put a \newpage inside a table? What is the line for? – S. Venkataraman May 25 '19 at 9:14
• Soooorry, it's a typo. – Brooks May 25 '19 at 9:16
• Can you make a rough drawing of what you want and upload the picture? – S. Venkataraman May 25 '19 at 9:18

I'd use standard exam methods, hooking into \lhead: the left header will contain \databox, whose duty is to typeset the data box having zero width and height, but with parameters to place it down the left margin. Then \databox redefines itself to do nothing.

\documentclass{exam}

\usepackage{lipsum}

\newcommand{\databox}{%
\smash{\makebox[0pt][r]{%
\begin{tabular}[t]{|c|}
\multicolumn{1}{c}{} \\[2in] % lower the box
\hline
name\\
\hline
\\[2\normalbaselineskip]
\hline
id\\
\hline
\\[1.5\normalbaselineskip]
\hline
subject\\
\hline
\\[3\normalbaselineskip]
\hline
}}%
\gdef\databox{}%
}

\begin{document}

\lipsum[1-9]

\end{document}


• how to move the table toward right a little bit but with the text on the right motionless. And I may concern whether the table will cover the text. – Brooks May 28 '19 at 6:55
• @Brooks Change \quad into \hspace{...} until you're satisfied. Tthe argument should be a length; as long as it's positive, the table will stay in the margin. – egreg May 28 '19 at 8:27

I suggest you set up two minipage environments, a narrow one on the left, a wide one on the right. As long as the contents of the minipages fit within the overall page, they will be centered vertically relative to each other. In the example below, the ratio of minipage widths is set to 3:17; obviously, you're free to choose a different ratio.

Then, in the left-hand minipage, use a single-column tabularx environment. Since it doesn't look like you need to set a \caption, I don't think there's a purpose in employing a table environment.

\documentclass{article}
\usepackage{lipsum,tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
\noindent
\begin{minipage}{0.15\textwidth}
\renewcommand\arraystretch{4} % or some other suitable factor
\begin{tabularx}{\textwidth}{|@{}C@{}|}
\hline
Name\\    \hline
{}\\      \hline
id\\      \hline
{}\\      \hline
subject\\ \hline
{}\\      \hline
\end{tabularx}
\end{minipage}