I would like to have lines for handwriting inside a tabularx, so I wrote this:
\documentclass[10pt]{article}
\usepackage[a4paper, total={18cm, 25cm}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tabularx}
\usepackage{pgffor, ifthen}
\newcommand{\notes}[3][\empty]{%
\foreach \n in {1,...,#2}{%
\ifthenelse{\equal{#1}{\empty}}
{\rule{#3}{0.5pt}\\}
{\rule{#3}{0.5pt}\vspace{#1}\\}
}
}
\begin{document}
\begin{tabularx}{\textwidth}{|l|l|}
\hline
\textbf{Question} & \textbf{Answer} \\
\hline
foo & \notes[10pt]{3}{5cm}\\
\hline
\end{tabularx}
\end{document}
Unfortunately I get this error
! Missing \endgroup inserted.
<inserted text>
\endgroup
l.27 \end{tabularx}
Any idea?
tabularx
if you don't have anX
type column in there?\\
inside of table cells inl
type columns to start a new line. You might want to replace\\
in your\notes
command with\newline
and use the command inside of ap
or similar column type.