I am still very new to LaTeX and was drawn to its chemistry packages. Since this is my first semester using LaTeX for reports, however this class requires pre-lab reports to be submitted as well. Anyway, long story short this lab will require a LOT of data and would like to organise it better in my copy of the pre-lab report. Rather than keeping it in my notebook hastily written. But, it is very messy and have no idea how to format it. I can I think \hrule it to various measurements but there must be an easier way to pad everything right to the furthest question preceding the colon so everything is aligned properly.

Maybe there is a nicer way of doing the boxes as well as I am eager to learn this much as I can for my future scientific career.

Below is the area in question:

\section*{Data}
Boiling point at first drop: \answerbox \\
Boiling point at last drop: \answerbox \\
Mass of essential oil after evaporation: \answerbox \\
Percent of essential oil based on mass of caraway oil: \answerbox \\
Mass of 2,4-DNP (\ce{C16H18O4N4}): \answerbox \\
Melting point of 2,4-DNP: \answerbox \\
Amount of carvone originally extracted: \answerbox \\
Amount of limonene in the oil: \answerbox \\
\tikz \draw[fill=yellow!3] (0,0) rectangle (\linewidth, -2in) node[pos=.14]   {Notes (Calculations/Odours):};


My preamble is here:

% Preamble
% -------------------------------------------------------------------------------
\documentclass{article}

\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage[utf8]{inputenc}
\pagenumbering{roman}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw,dvipsnames]{xcolor}
\usepackage[version=3]{mhchem}
\usepackage{chemfig}
\usepackage{gensymb}

% ------------------------------------------------------------------------------
% Definitions (do not change this)
% ------------------------------------------------------------------------------
\newcommand{\HRule}[1]{\rule{\linewidth}{#1}}   % Horizontal rule

\makeatletter                           % Title
\def\printtitle{%
{\centering \@title\par}}
\makeatother

\makeatletter                           % Author
\def\printauthor{%
{\centering \large \@author}}
\makeatother

\fbox{\rule{2.5cm}{0pt}\rule[-0.2ex]{0pt}{2ex}}}


• Please have a look on the exam class -- it has support for such answerboxes (however, they are named differently)
– user31729
Oct 11 '15 at 21:07
• \begin{tabular}{ll}Stuff on left & Answer on right\\Next left & Next right\\...\end{tabular} ??
– cfr
Oct 11 '15 at 21:12
• I was considering using a table as it should line up easier but felt there had to be a good class, exam seems promising though too. Oct 11 '15 at 21:14
• I wouldn't use exam for this. Not just to draw some boxes. If you were teaching the class, sure, it might be useful. But for preparing your pre lab report? It will just complicate things. At least, that's what I'd think.
– cfr
Oct 11 '15 at 21:17

A pretty 'hack' ;-)

I put the descriptions into a comma separated list which is displayed by \MakeTable[options for answerbox]{width of description column}{width of answerbox}[Heading of notes box]<height of notes box>

More features could be added, but require time ;-)

\documentclass{article}

\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage[utf8]{inputenc}
\pagenumbering{roman}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw,dvipsnames]{xcolor}
\usepackage[version=3]{mhchem}
\usepackage{chemfig}
\usepackage{gensymb}

\usepackage[most]{tcolorbox}

% ------------------------------------------------------------------------------
% Definitions (do not change this)
% ------------------------------------------------------------------------------
\newcommand{\HRule}[1]{\rule{\linewidth}{#1}}   % Horizontal rule

\makeatletter                           % Title
\def\printtitle{%
{\centering \@title\par}}
\makeatother

\makeatletter                           % Author
\def\printauthor{%
{\centering \large \@author}}
\makeatother

\begin{tcolorbox}[nobeforeafter,width=2.5cm,enhanced jigsaw,colback=white,sharp corners,#1]
\end{tcolorbox}
}

\usepackage{array}

\usepackage{xparse}

\newtcolorbox{notesbox}[2][]{nobeforeafter,boxrule=0pt,colback=white,enhanced jigsaw,sharp corners,width=\linewidth,height=#2,#1}

\ExplSyntaxOn
\clist_new:N \g_jon_topics_clist

\NewDocumentCommand{\FillTopicsList}{m}{%
\clist_set:Nn \g_jon_topics_clist {#1}
}

\NewDocumentCommand{\DisplayTopicsList}{O{}}{%
\clist_map_inline:Nn \g_jon_topics_clist { ##1: & \answerbox[#1] \tabularnewline}
}

\ExplSyntaxOff

\NewDocumentCommand{\MakeTable}{O{}mmO{Notes(Calculations/Odours}D<>{0.4\textheight}}{%
\begin{tabular}{m{#2}m{#3}}
\tabularnewline
\DisplayTopicsList[#1]
\tabularnewline
\hline
\multicolumn{2}{|l|}{%
#4
}\tabularnewline
\multicolumn{2}{|@{}l@{}|}{%
\begin{notesbox}[#1]{#5}
\end{notesbox}
}\tabularnewline
\hline
\end{tabular}
}

\begin{document}
\section*{Data}
\FillTopicsList{Boiling point at first drop,Boiling point at last drop,
Tared flask weight with decanted solution (1.0 mg),
Mass of essential oil after evaporation,
Percent of essential oil based on mass of caraway oil
Mass of 2,4-DNP (\ce{C16H18O4N4}),
Melting point of 2,4-DNP,
Amount of carvone originally extracted,
Amount of limonene in the oil,
Percent of limonene,
Percent of carvone,
}

\MakeTable{6cm}{2.5cm}<0.3\textheight>

\MakeTable[colback={yellow!40!white}]{6cm}{2.5cm}<0.3\textheight>

\end{document}


• This seems perfect.. Will play around to tweak it so it still fits on the previous page with the rest of the content and make the rows fit on the same line without wrapping, but wow, this will be very useful will definitely reuse this for other labs. Thank you so much! This community is awesome! Oct 11 '15 at 22:20
• @JonWeinraub: You're welcome ... of course you've to change some parameters. If you've some questions about the ExplSyntaxOn features, don't hesitate (I learned it too during the last days ;-))
– user31729
Oct 11 '15 at 22:21
• What causes the size of the table so I can "shrink" it so I can fit it in the previous page? Oct 11 '15 at 22:54
• @JonWeinraub: I would say the height of the notes box. \MakeTable{6cm}{2.5cm}<0.2\textheight> The value in the <...> bracket pair controls the height of the notes box
– user31729
Oct 11 '15 at 22:57