GeneralMissing } inserted / Nesting commands

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ecastro
Posts: 3
Joined: Fri Apr 21, 2023 3:50 am

Missing } inserted / Nesting commands

Post by ecastro »

Hi,

I'm trying to create some checklists with Latex using a template that I've found here: https://github.com/mavcunha/checklists/ ... eamble.inc

I want to do some special things, such as getting some items in the checklist to have a colored background. So I tried to do something like:

Code: Select all

Code, edit and compile here:
\begin{checklist}{Cockpit}
\colorbox{blue!10}{
\item{Gear switch} {VERIFY DOWN}
\item{Magneto/Starter} {VERIFY OFF}
\item{Avionics Switch} {VERIFY OFF}
\item{Master Switch} {SET ON}
\item{Fuel gauges, quantity} {CHECK}
}
\item{Pitot heat} {SET ON}
\item{Interior/Exterior lights} {SET ON}
\item{Interior lights} {CHECK}
\item{Exterior lights} {CHECK}
\end{checklist}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
But I'm getting the Missing } inserted.

I have already invested some hours and I cannot fully understand the issue, let alone how to fix it!

Any help?! :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

TikZ book: Now 40% off at Amazon for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Missing } inserted / Nesting commands

Post by Stefan Kottwitz »

Hi,

welcome to the forum!

You cannot have \item inside a \colorbox. If you take the box out, it works:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{xcolor,booktabs}
\newenvironment{checklist}[1]{%
\renewcommand{\item}[2]{%
##1\hspace{2em}\dotfill\makebox{\uppercase{##2}}\\
}
\newcommand{\step}[1]{%
\hspace*{10em}-\hspace*{\labelsep}##1\\
}
\begin{tabular}{p{0.8\linewidth}}
\toprule
\multicolumn{1}{c}{\textbf{\uppercase{#1}}}\\
\midrule
}{\bottomrule\end{tabular}\vspace{1em}}
\begin{document}
\begin{checklist}{Cockpit}
% \colorbox{blue!10}{
\item{Gear switch} {VERIFY DOWN}
\item{Magneto/Starter} {VERIFY OFF}
\item{Avionics Switch} {VERIFY OFF}
\item{Master Switch} {SET ON}
\item{Fuel gauges, quantity} {CHECK}
% }
\item{Pitot heat} {SET ON}
\item{Interior/Exterior lights} {SET ON}
\item{Interior lights} {CHECK}
\item{Exterior lights} {CHECK}
\end{checklist}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Perhaps use color within \item.

Stefan
LaTeX.org admin
ecastro
Posts: 3
Joined: Fri Apr 21, 2023 3:50 am

Missing } inserted / Nesting commands

Post by ecastro »

Thanks Stefan for the quick reply. Maybe I should have stated the end result that I'm looking for rather than the issue I'm having.

So I want to achieve something like this:
2023-04-21 10_53_26-Missing } inserted _ Nesting commands — Mozilla Firefox.png
2023-04-21 10_53_26-Missing } inserted _ Nesting commands — Mozilla Firefox.png (26.31 KiB) Viewed 1640 times
I tried doing it inside item command but was not able to achieve this result, then I tried doing it outside and I get this error.

Could you point me in the right direction on how to achieve something like this?
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Missing } inserted / Nesting commands

Post by Bartman »

You could use the commands of the colortbl package to color the table rows. The xcolor package manual tells you how to load it.

Code: Select all

Code, edit and compile here:
\documentclass[
% 10pt,% standard setting of the class
twocolumn
]{article}
\usepackage{booktabs}% def toprule, midrule and etc.
\usepackage[landscape]{geometry}
\usepackage[cm]{fullpage}
\usepackage[table]{xcolor}% added to color the table rows
\usepackage{tikz}% loads xcolor
\usepackage{environ}
\usepackage{fancyhdr}
\usepackage{amssymb}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% creates empty checkboxes to be used as the second
% argument to \item on checklist
\newcommand{\checkbox}{\makebox[3ex][r]{\Large{$\square$}}}
% draws a dashed box around to group checklists
% a task has a title, which is the group title
\NewEnviron{task}[1]{\par
\begin{tikzpicture}
\node[rectangle,minimum width=0.9\linewidth] (m)
{\begin{minipage}{0.85\linewidth}
\begin{center}\uppercase{#1}\\\vspace{1em}\BODY\end{center}
\end{minipage}};
\draw[dashed](m.south west) rectangle (m.north east);
\end{tikzpicture}\vspace{1em}
}
% checklist env sets up a table and format the items.
% in case a item has steps use the \step{asdf}
% command.
\newenvironment{checklist}[1]{%
\renewcommand{\item}[2]{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ecastro
Posts: 3
Joined: Fri Apr 21, 2023 3:50 am

Missing } inserted / Nesting commands

Post by ecastro »

Awesome, thank you!
Post Reply