TransWikia.com

Using the tabto package to annotate items in an itemize list

TeX - LaTeX Asked on January 6, 2021

In the following MWE, I am trying to use the tabto package to annotate items in an itemize list:

But, I’d like the "Chapter" annotations to be vertically aligned with the first line of the item, not the last line. How can I do this?

documentclass[oneside,11pt]{book}

usepackage[semibold,tt=false]{libertine}
usepackage{libertinust1math}
usepackage[
  expansion = false ,
  tracking = smallcaps ,
  letterspace = 40 ,
]{microtype}
usepackage{enumitem}

usepackage{tabto}
newcommand{mytab}{tabto{5.0cm}}

begin{document}

begin{itemize}
  item{Fruits}
    begin{itemize}
      item{apples(crisp)}mytab Chapter 1
      item{oranges(juicy)}mytab Chapter 1
    end{itemize}
  item{Vegetables}
    begin{itemize}
      item{cucumbers(crunchy)}mytab Chapter 2
      item{green beans(squishy)}mytab Chapter 2
    end{itemize}
end{itemize}

end{document}

mwe

2 Answers

Here is how you could imitate the look of the nested itemize uwing a tabular:

enter image description here

documentclass[oneside,11pt]{book}

usepackage[semibold,tt=false]{libertine}
usepackage{libertinust1math}
usepackage[
  expansion = false ,
  tracking = smallcaps ,
  letterspace = 40 ,
]{microtype}
usepackage{enumitem}

begin{document}

begin{itemize}
  item{Fruits}
  
  begin{tabular}{@{quad}l@{;}p{5cm}l}
   -- & apples  &  Chapter 1
      &(crisp)              [5pt]
   -- & oranges & Chapter 1 
      & (juicy)              
  end{tabular}
  item{Vegetables}
  
  begin{tabular}{@{quad}l@{;}p{5cm}l}
   -- & cucumbers   & Chapter 2 
      &(cucumbers)              [5pt]
   -- & green beans & Chapter 2 
      & (squishy)                
  end{tabular}
end{itemize}
end{document}

Answered by leandriis on January 6, 2021

Don't put the item contents in braces. Rather, slightly redefine mytab, but its argument in braces AND place the mytab at the start of the item.

documentclass[oneside,11pt]{book}

usepackage[semibold,tt=false]{libertine}
usepackage{libertinust1math}
usepackage[
  expansion = false ,
  tracking = smallcaps ,
  letterspace = 40 ,
]{microtype}
usepackage{enumitem}

usepackage{tabto}
newcommandmytab[1]{tabto{5.0cm}#1tabto*{TabPrevPos}}

begin{document}

begin{itemize}
  item{Fruits}
    begin{itemize}
      itemmytab{Chapter 1}apples(crisp)
      itemmytab{Chapter 1}oranges(juicy)
    end{itemize}
  item{Vegetables}
    begin{itemize}
      itemmytab{Chapter 2}cucumbers(crunchy)
      itemmytab{Chapter 2}green beans(squishy)
    end{itemize}
end{itemize}

end{document}

enter image description here

Answered by Steven B. Segletes on January 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP