4

I'm trying to create a question sheet for pupils in which they fill out the proton and atomic numbers of elements after they undergo radioactive decay.

I have succeeded in using the mhchem environment and tikz to produce the following worksheet:

enter image description here

using the following code:

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{tikz}
\usepackage[version=4]{mhchem}

\newcommand\isotope{
\begin{tikzpicture}[scale=0.5, baseline=-4pt]
\draw (0,0.1) rectangle (1.5,1.1)
(0,-0.1) rectangle (1.5,-1.1)
(1.7,-1.1) rectangle (3.8,1.1);
\end{tikzpicture}}

\begin{document}

\begin{enumerate}
\begin{huge}
\item $\!\begin{aligned}[t] 
 \ce{^213_90Th -> ^4_2\alpha{} + & \isotope} \\
 \end{aligned}$
\item $\begin{aligned}[t] 
 \ce{^194_86Rn -> ^4_2\alpha{} + & \isotope} \\
 \end{aligned}$
\item $\begin{aligned}[t] 
 \ce{^217_91Pa -> ^4_2\alpha{} + &  \isotope} \\
 \end{aligned}$
\item $\begin{aligned}[t] 
 \ce{^221_90Th -> ^4_2\alpha{} + & \isotope} 
 \end{aligned}$
  \end{huge}
\end{enumerate}


\end{document}

However, notice how the boxes do not align with each other, which drives me crazy.

I have tried to use the align* environment with the enumerate environment to no avail.

My latest attempt is with the aligned[t] environment but as you can see this hasn't fixed the problem.

Any ideas how I can fix this?

4

Updated answer, without automagic isotopes:

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{tikz}
\usepackage[version=4]{mhchem}

\newcommand\isotope{
\medskip\par
\begin{tikzpicture}[scale=0.5, baseline=-4pt]
\draw (0,0.1) rectangle (1.5,1.1)
(0,-0.1) rectangle (1.5,-1.1)
(1.7,-1.1) rectangle (3.8,1.1);
\end{tikzpicture}}


\usepackage{array}
\newcounter{rows}
\newcolumntype{C}{>{\stepcounter{rows}}l<{\arabic{rows}.}}
\newcolumntype{A}{c<{\ce{->}}}

\setlength{\tabcolsep}{4pt}

\begin{document}

\begin{tabular}{ClAll}
  & \ce{^213_90Th} &  &  \ce{^4_2\alpha{}}  &  + \isotope \\
  & \ce{^194_86Rn} &  &  \ce{^4_2\alpha{}}  &  + \isotope \\
\end{tabular}

\end{document}

This gives

enter image description here

Explanation: we use a tabular instead of an enumerate to achieve alignment. The counter is generated by a special column type C, which augments a counter and typesets the value; within the table, you don't have to fill in anything. We use a similar trick for the reaction arrow; it is provided by a custom A column type, so that all you have to do is to insert an empty table cell.

The problem posed is also a nice opportunity to showcase Martin Scharrer's collcell package, which provides an easy way to apply a macro to the contents of each table cell. Here, we define an E column type that applies mhchems \ce macro to each cell. Moreover, we create another I column type that populates each cell with the custom-defined \isotope macro:

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{tikz}
\usepackage[version=4]{mhchem}
\usepackage{collcell}

\newcommand\isotope{
\medskip\par
\begin{tikzpicture}[scale=0.5, baseline=-4pt]
\draw (0,0.1) rectangle (1.5,1.1)
(0,-0.1) rectangle (1.5,-1.1)
(1.7,-1.1) rectangle (3.8,1.1);
\end{tikzpicture}}


\usepackage{array}
\newcounter{rows}
\newcolumntype{C}{>{\stepcounter{rows}}l<{\arabic{rows}.}}
\newcolumntype{A}{c<{\ce{->}}}
\newcolumntype{I}{l<{+ \isotope}}
\newcolumntype{E}{>{\collectcell\ce}l<{\endcollectcell}}


\setlength{\tabcolsep}{4pt}

\begin{document}

\begin{tabular}{CEAEI}
  & ^213_90Th &  &  ^4_2\alpha  &  \\
  & ^194_86Rn &  &  ^4_2\alpha  &  \\
\end{tabular}

\end{document}

The output is the very same as shown above.

2
  • This is good, but I have other functions similar to isotope that take arguments (such as the proton number but leave the atomic symbol and mass number empty), so I need the \isotope command not to be a column type, and it's difficult to see how to incorporate that into your solution. Jul 8 '17 at 22:41
  • see updated answer - just use a plain l, c or r column and type in the \isotope macros manually. Jul 8 '17 at 22:48
4

I propose a solution with the listliketab package, in the place of a real list. The ‘items’ can be cross-referenced.

I also defined a \myisotope command, which doesn't require tikz, but simply relies on hhline:

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{tikz}
\usepackage[version=4]{mhchem}
\usepackage{array, hhline, enumitem, listliketab}

\newcommand\isotope{%
\begin{tikzpicture}[scale=0.5, baseline=-4pt]
\draw (0,0.1) rectangle (1.5,1.1)
(0,-0.1) rectangle (1.5,-1.1)
(1.7,-1.1) rectangle (3.8,1.1);
\end{tikzpicture}}
\newcommand\myisotope{\renewcommand{\arraystretch}{0.6}\setlength\extrarowheight{12pt}\begin{tabular}{|p{10pt}||p{18pt}|}\hhline{-||-}& \\\hhline{:=:|~|} & \\\hhline{|-||-|}\end{tabular}}%&

\begin{document}

\storestyleof{enumerate}
\begin{listliketab}
\newcounter{tabenum}\setcounter{tabenum}{0}
\newcommand{\tabitem}{\refstepcounter{tabenum}\thetabenum.}
\begin{tabular}{Lr@{}l}
\tabitem\label{th} & \ce{^213_90Th -> ^4_2\alpha{} +} & \myisotope\\[20pt]
\tabitem & \ce{^194_86Rn -> ^4_2\alpha{} +} & \myisotope\\[20pt]
\tabitem & \ce{^217_91Pa -> ^4_2\alpha{} +} & \myisotope \\[20pt]
\tabitem & \ce{^221_90Th -> ^4_2\alpha{} +} & \myisotope
\end{tabular}
\end{listliketab}

Reaction \ref{th}

\end{document} 

enter image description here

2
  • Can you explain what listliketab actually does for you here? I see you still generate the item labels with a custom counter. Is it just for the sake of cross-referencing? Jul 8 '17 at 23:29
  • 1
    Not only: the spacing is formatted like a true enumerate. Actually, it emulates enumerate within a table, defining a new column type. I guess one could automate the whole process in the preamble, initialising a counter in the background, so that one would only see a tabular and the \tabitem commands.
    – Bernard
    Jul 8 '17 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.