
The problem I'm having is to get consistency in the vertical positioning of elements. The order in which I apply elements is:
- Recipe title
- Created Recipe indicator
- Tested Recipe indicator
- Prep/Servings/Rating_Stars/Cook/Temp line
- Output the title
- If a "heart" needs to be outputted, move the "cursor" back up to the middle of the title band (\vspace-20pt})
- Output the "heart" symbol
- Move the "cursor" back down to where I think it came from. (I'm guessing)
- If a "check" needs to be outputted, move the "cursor" back up to the middle of the title band (\vspace{-23pt})
- Output the "check" symbol after moving it across to the right hand side (\hfill) with a bit of space beyond it (\hspace{20pt}.
- Move the "cursor" back down to some default position
- output the Prep/Servings/Rating_Stars/Cook/Temp line
- Now output the ingredients and instructions etc...
There are four circumstances that could occur:
- Both "heart" and "check" appear with the title in the title band
- Only the "heart" appears with the title in the title band
- Only the "check" appears with the title in the title band
- Only the title is in the title band
How should I best go about this. Just give me the direction in which I should examine/research/learn and I'll figure it out.
Thanks,
Peter
The (partial) code to produce this piece is:
Code: Select all
\newpage%===============================================================================================\indexedsubsection{Italian Bread}%===============================================================================================% Put in the Created Recipe indicator.\raggedright\vspace{-20pt}\hspace{20pt}\ding{164}\vspace{10pt}% Put in the Tested Recipe indicator.\raggedright\vspace{-23pt}\hfill\ding{52}\hspace{20pt}\vspace{13pt}% preparation time, servings, 3, and 40 time and oven temperature\vspace{-10pt}\begin{center}\begin{tabularx}{\textwidth}{ >{\raggedright\arraybackslash}X c >{\raggedleft\arraybackslash}X }{\small \textsc{Prep:} 40 min \textsc{Make:} 1 loaf} & {\large \ding{72}\ding{72}\ding{72}\ding{73}\ding{73}} & {\small \textsc{Cook:} 40 min @ 400°F}\end{tabularx}\end{center}\vspace{-10pt}% Middle band: Ingredients (two columns)\vspace{-\topsep}\begin{multicols}{2}\raggedright\begin{itemize}\item 1 cup warm water\item 1 egg\item 2 tbsps olive oil\item 2 tbsps honey\item 500 grams flour\end{itemize}\columnbreak\begin{itemize}\item 1½ tsps salt
The code for \indexedsubsection{Italian Bread} is pretty straightforward:
Code: Select all
\usepackage[]{imakeidx} % makeidx: Standard LaTeX package for creating indexes\usepackage[]{tcolorbox} % tcolorbox: Coloured boxes, for LaTeX examples and theorems, etc\makeindex% Define custom gray colors\definecolor{mylightgray}{RGB}{220, 220, 220} % RGB example% Define the new tcolorbox environment with a custom gray color\newtcolorbox{mysectionbox}[1][]{colback=mylightgray, % Use the custom colorcolframe=mylightgray,width=\textwidth,boxrule=0pt,left=0pt,right=0pt,top=10pt, % Adjust this value for the top paddingbottom=10pt, % Adjust this value for the bottom paddingboxsep=0pt,before skip=0pt,after skip=0pt,parbox=false,valign=center,fontupper=\bfseries\large\centering, % Center the text#1}% Redefine \subsection to use the custom tcolorbox environment and add to ToC and index\newcommand{\indexedsubsection}[1]{%\vspace{0pt} % Adjust this value for white space above\begin{mysectionbox}\textbf{\large #1}\end{mysectionbox}\addcontentsline{toc}{subsection}{#1} % Add to table of contents\index{#1} % Add to index\vspace{0pt} % Adjust this value for white space below}