Graphics, Figures & TablesHow to ForEach into nested \fbox, \vbox, \hbox

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
teer
Posts: 2
Joined: Sat Sep 19, 2020 11:15 pm

How to ForEach into nested \fbox, \vbox, \hbox

Post by teer »

So I have this Eisenhower square that will contain checkboxes (see attachment)
How do I then add items to it? itemize does not play well inside f/v/hboxes.

Ideally, I'd like to have a \newcommand with items delimited by a comma ','
which I could then pass as a parameter to get ForEach'd into items (see commented ForEach statement in \eisenbox)
I am reluctant to switch to tabular or tikz because getting to what I current have was no easy feat.

But I am new to LaTeX and nothing seems to work.
Any help would be very much appreciated!
...
% \eisenlabel{width}{label}
\newcommand\eisenlabel[2]{\makebox[#1]{\small\sffamily#2}}

% \veisenlabel{height}{label}
\newcommand\veisenlabel[2]{\turnbox{90}{\eisenlabel{#1}{#2}}\ }

\newcommand\eisenbox[3]{\fbox{%
	\ifthenelse{\equal{#3}{0}}{
		\vbox to #1{%
			\hbox to #2{\textcolor{white}{$\square$}\hfill}%
			\vfill 
		}%
	}{
		\vbox to #1{%
        	       	\hbox to #2{\textcolor{black}{$\square$}\hfill}
			% \ForEach{,}{\hbox to #2{$\square$ \thislevelitem\hfill}}{#3}			
			\vfill 
		}%
	}
}}

% \eisensquare{height of single box}{width of single box}{top left}{top right}{bottom left}{bottom right}
\newcommand\eisensquare[6]{{%
	\fboxrule=0.1ex%
	\vbox{%
		\hbox{\ \eisenlabel{#2}{urgent}\ \eisenlabel{#2}{not urgent}}%
		\hbox{\veisenlabel{#1}{important}\eisenbox{#1}{#2}{\topleft}\hspace{-\fboxrule}\eisenbox{#1}{#2}{\topright}}%
		\nointerlineskip
		\vspace{-\fboxrule}%
		\hbox{\veisenlabel{#1}{not important}\eisenbox{#1}{#2}{\bottomleft}\hspace{-\fboxrule}\eisenbox{#1}{#2}{\bottomright}}%
	}
}}

% \topright
\newcommand{\topright}{Abandon ship,Close down circus,evacuate zoo}

...

\begin{document}
	\frontmatter
	
	\maketitle
	
	\tableofcontents
	\setcounter{page}{0}
	\clearpage
	
	\mainmatter

	\subfile{./subfile.tex}
	
	\backmatter
	
\end{document}
\begin{document}
...
	\paragraph{Foo}\mbox{}\\
		\noindent
		\eisensquare{5\baselineskip}{0.4\textwidth}{0}{5}{3}{1}
...
\end{document}
Attachments
esquare.png
esquare.png (7.21 KiB) Viewed 1741 times

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply