# Creating a LaTeX Math Homework Template with Tables

I am trying to make a simple math homework template (as a student) to answer questions from a book. So far it has gone alright but I have hit a roadblock: I cant seem to get the tables right.

Fig. 1: A snippet from the pdfLaTeX-produced document which shows the problem.

\begin{tabular*}{\textwidth}{L@{\extracolsep{\fill}}CR}
\textbf{A} & \textbf{B} & \textbf{C} \\
a & a & a \\
\end{tabular*}


The math columntypes.

\newcommand{\rtable}[2]{\newcolumntype{#2}{>{$}#1<{$}}}
\rtable{l}{L}   \rtable{c}{C}   \rtable{r}{R}


And im using this to create the L C R math versions of the regular l c r column types. If you have better ways to do this without using tables or some more specific package please do let me know.

NOTE: If you yourself are also trying to do this I used this piece of code to match the math books numbering system; thanks to this piece of code I do not need to manually set the numbers every time

\renewcommand{\thesubsection}{\arabic{section}.\Alph{subsection}}
\renewcommand{\thesubsubsection}{\arabic{section}.\Alph{subsection}.\arabic{subsubsection}}


And this to set the starting point because often I will seperate it to different .pdf files

\setcounter{section}{0}
\section{Mengi}
\setcounter{subsection}{0}
\subsection{Stök og Venn-myndir}
\setcounter{subsubsection}{0}
\subsubsection{Test}


Fig 2: Image of almost perfect outcome

Here is another try where I used simple minipages with 0.333\textwidth and they work very well with \flushleft, \centerline, and \flushright respectively.

HOWEVER: The problem with this is that, you might notice, its not using a math environment, and I was never able to get math-mode inside of the minipages, the text was really weird, huge margins and all kinds of really weird stuff so I gave up. This image should illustrate what the perfect outcome should be (only the math mode is missing)

• NOTE: I tried using minipages first for this but it quickly became extremely ugly and didnt format correctly with math-mode. Sep 7 '20 at 14:57
• Why not use array instead of tabular? Sep 7 '20 at 15:31
• I dont know, I havent tried it? Im going to right now. Sep 7 '20 at 15:33
• I dont really see array working for this, I have been trying to get somwhere but I dont see any future in this. Sep 7 '20 at 15:45
• Having had another closer look at your question, I must admit I don't really undestand what exactly you would like to achive. Probably some background infromation or a sketch of the desired output would be helpful. Do you want three columns that will always have the same width regardless of their contents or something else? How would some examples of the actual contents of such a table look like? Simple numbers, equations or something entirely different? Sep 7 '20 at 17:59

So, I have managed to hack this together with the following code using tabularx:

\newcommand{\svar}[6]{\begin{tabularx}{\linewidth}{|x|C|x|}
\hline
\hspace{-1.9mm}\textbf{#1} & $\centerline{\textbf{#3}}$ & \rightline{\textbf{#5}}\\
\hline
#2$&$#4$& \rightline{$#6$} \\ \hline\end{tabularx} }  The \hline's (and corresponding |'s) are only for reference while im working on this. The big downside to this solution is that it does not allow for any kind of linebreaks which ideally I should be able to use when writing longer equations etc. Any help would be immensely helpful, I never thought this would be a weeks long dreadful project. I am desperate at this point. \newcolumntype{C}{>{\centering\arraybackslash}X} \newcommand{\rtable}[2]{\newcolumntype{#2}{>{$}#1<{\$}}}
\rtable{X}{x}


The redefined columns to allow for this hack.

## This template work has been seriously draining my mental health, so I'm very sorry if I might answer in a passive-agressive tone.

• if you are reading this send help. Sep 9 '20 at 12:30