Text FormattingLists

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
the_obs
Posts: 9
Joined: Mon Oct 18, 2010 9:18 pm

Lists

Post by the_obs »

Hey guys,
How can I get Latex to produce lists as following:
Image

I would like text (here, ALT and SEQ) underneath an item to be aligned with the above item's text. I tried easylist but I can't get text underneath to align correctly. It does this:
Image

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Lists

Post by gmedina »

Hi,

the enumitem package could be useful:

Code: Select all

\documentclass[11pt,twoside]{article}
\usepackage{enumitem}

\newlist{legal}{enumerate}{10}
\setlist[legal]{label*=\arabic*.,nolistsep,leftmargin=*}

\begin{document}

\begin{legal}[nolistsep]
  \item Plan your...\\
  SEQ
    \begin{legal}
      \item Log...
      \item Select...
      \item Define...\\
      ALT
      \begin{legal}
        \item A subsubitem....
        \item Another subsubitem....
      \end{legal}
    \end{legal}
\end{legal}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
the_obs
Posts: 9
Joined: Mon Oct 18, 2010 9:18 pm

Re: Lists

Post by the_obs »

That worked like a charm. This is the third time you have answered my questions, thank you so much, gmedina.
the_obs
Posts: 9
Joined: Mon Oct 18, 2010 9:18 pm

Lists

Post by the_obs »

New challenge: is there anyway I can format my list to look like this?
Image
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Lists

Post by gmedina »

Since \multirow doesn't accept the \columncolor command, you'll need two tabular environments (one for the "Main Success" block and another for the alternating color table); the height for the first block will need manual adjustment:

Code: Select all

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{multirow}
\usepackage{chngcntr}

\newcounter{Myiti}
\newcounter{Myitii}
\newcounter{Myitiii}
\counterwithin{Myitii}{Myiti}
\counterwithin{Myitiii}{Myitii}

\newcommand*\Itemi{\stepcounter{Myiti}\theMyiti.}
\newcommand*\Itemii{\stepcounter{Myitii}\theMyitii.}
\newcommand*\Itemiii{\stepcounter{Myitiii}\theMyitiii.}

\definecolor{BlueI}{RGB}{15 110 198}
\definecolor{BlueII}{RGB}{116 184 244}
\definecolor{BlueIII}{RGB}{186 219 249}

\begin{document}

\begin{tabular}[t]{>{\columncolor{BlueI}\bfseries}p{2cm}}
  \textcolor{white}{Main} \\
  \textcolor{white}{Success} \\[161.6pt]% adjust manually
\end{tabular}\hspace*{-4pt}
\rowcolors{1}{BlueII}{BlueIII}
\arrayrulecolor{white}
\begin{tabular}[t]{r|>{\raggedright\arraybackslash}p{6cm}}
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemiii & Text \\ \hline
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemiii & Text \\ \hline
  \Itemiii & Text \\ \hline
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
\end{tabular}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Lists

Post by frabjous »

Building on gmedina's idea, one way perhaps to avoid manually calculating the height of the one table would be to stick the other table in a savebox and use it as a whole as a column in the first one.

Code: Select all

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{fouriernc}
\usepackage{multirow}
\usepackage{chngcntr}

\newcounter{Myiti}
\newcounter{Myitii}
\newcounter{Myitiii}
\counterwithin{Myitii}{Myiti}
\counterwithin{Myitiii}{Myitii}

\newcommand*\Itemi{\stepcounter{Myiti}\theMyiti.}
\newcommand*\Itemii{\stepcounter{Myitii}\theMyitii.}
\newcommand*\Itemiii{\stepcounter{Myitiii}\theMyitiii.}

\definecolor{BlueI}{RGB}{15 110 198}
\definecolor{BlueII}{RGB}{116 184 244}
\definecolor{BlueIII}{RGB}{186 219 249}

\begin{document}


\newsavebox{\mylist}
\savebox{\mylist}{%
\rowcolors{1}{BlueII}{BlueIII}
\arrayrulecolor{white}
\begin{tabular}[t]{@{}|r|>{\raggedright\arraybackslash}p{6cm}}
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemiii & Text \\ \hline
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemiii & Text \\ \hline
  \Itemiii & Text \\ \hline
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemi & Text \\ \hline
  \Itemii & Text \\ \hline
  \Itemii & Text \\ \hline
\end{tabular}}

\begin{tabular}{>{\columncolor{BlueI}\bfseries}p{2cm}|@{\hspace*{-3pt}}l}
  \textcolor{white}{Main \newline Success} &
 \usebox{\mylist} 
\end{tabular}\hspace*{-4pt}

\end{document}

Post Reply