Text Formattingitemize list with multiline-items

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
timmothey
Posts: 2
Joined: Tue Jun 15, 2010 5:31 pm

itemize list with multiline-items

Post by timmothey »

Hi there LaTeX Community!

I'm beginning to force me to learn how to handle LaTeX and could fix all my issues by searching the web and all these helpful forums.
But now, guess what: I couldn't find a fix for my latest issue.

That's the point: I have some equations which should be in a list.

For Example:

Code: Select all

\begin{itemize}
\item \begin{array}{cll}&\texttt{isempty(rest(prefix(a,prefix(b,} empty \texttt{))))} &= \texttt{false}\\
\Leftrightarrow &\texttt{isempty(rest(prefix(a,[b])))} &= \texttt{false}\\
\Leftrightarrow &\texttt{isempty(rest([a,b]))} &= \texttt{false}\\
\Leftrightarrow &\texttt{isempty([b])} &= \texttt{false}\\
\Leftrightarrow &\texttt{false} &= \texttt{false}\; \checkmark
\end{array}
\item \begin{array}{cll}&\texttt{last(lead(postfix(a,postfix(b,} empty \texttt{))))} &= \texttt{b}\\
\Leftrightarrow &\texttt{last(lead(postfix(a,[b])))} &= \texttt{b}\\
\Leftrightarrow &\texttt{last(lead([b,a]))} &= \texttt{b}\\
\Leftrightarrow &\texttt{last([b])} &= \texttt{b}\\
\Leftrightarrow &\texttt{b} &= \texttt{b}\; \checkmark
\end{array}
\end{itemize}
My Problem is that the dot of the list centers vertically to each equation.
Maybe it is a missusage like I did that...

Could you help me fix this?
Later in my script there are familiar issues, but I think I could fix this if this works.

Thanks in advice,
Tim

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

itemize list with multiline-items

Post by localghost »

Code snippets are completely useless. So, please always provide a full example [1]. The array environment accepts an optional parameter for the placement with respect to the current line. But you don't need to switch to math mode in this case.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}

\begin{document}
  \begin{itemize}
    \item \begin{tabular}[t]{>{$}c<{$}l@{\,=\,}l}
                 & \texttt{isempty(rest(prefix(a,prefix(b,} empty \texttt{))))} & \texttt{false} \\
            \iff & \texttt{isempty(rest(prefix(a,[b])))} & \texttt{false}\\
            \iff & \texttt{isempty(rest([a,b]))} & \texttt{false}\\
            \iff & \texttt{isempty([b])} & \texttt{false}\\
            \iff & \texttt{false} & \texttt{false}\; $\checkmark$
          \end{tabular}
    \item \begin{tabular}[t]{>{$}c<{$}l@{\,=\,}l}
                 & \texttt{last(lead(postfix(a,postfix(b,} empty \texttt{))))} & \texttt{b}\\
            \iff & \texttt{last(lead(postfix(a,[b])))} & \texttt{b}\\
            \iff & \texttt{last(lead([b,a]))} & \texttt{b}\\
            \iff & \texttt{last([b])} & \texttt{b}\\
            \iff & \texttt{b} & \texttt{b}\; $\checkmark$
          \end{tabular}
  \end{itemize}
\end{document}
The default setting in vertical alignment for such array like environments is centered with respect to the current line. For more information about the involved packages see their documentations on CTAN.

[1] View topic: Avoidable mistakes


Best regards and welcome to the board
Thorsten
timmothey
Posts: 2
Joined: Tue Jun 15, 2010 5:31 pm

itemize list with multiline-items

Post by timmothey »

Wow!
At a first look this seems to be a crash with a box of symbols but it makes sense! Thanks a lot!

I'm beginning to like these short expressions with powerful effects.
But there is one point I couldn't get: Why is the import of the array-package of such an importance (of course because of the regex-like thing after the tabular beginning). But I don't use an array - or do I?

In your example you used this:

Code: Select all

\begin{tabular}[t]{>{$}c<{$}l@{\;=\;}l}
So what it does is it puts $ Symbols before and after each cell of the first column?! Is it required to have the <{...} thing everytime? So in this case it's clear - yes, but in another context?

I read something about this [t]: It is something like the anchor. If I use t it uses the first row of the table as anchor, otherwise (if b is given) the last one.
But what is the anchor for? That is something I couldn't figure out (maybe because of missing knowledge how to interpret manuals).

In CTAN (nice source - thanks for that) I couldn't find tabular but tabulary what was inapprehensible to me. Is there another keyword I can look for (in this special source)?

Thank's a lot for your quick advice!
I never had forums (not talking about LaTeX but other developer boards) with such replies of this quality!

Sorry for failing the board rules. I hope I will fit soon and maybe be able to help others (which will definitely take a while). I'm just not familiar enough with the document structure to know which are the important parts...

Best regards
Tim
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

itemize list with multiline-items

Post by localghost »

timmothey wrote:[...] Why is the import of the array-package of such an importance (of course because of the regex-like thing after the tabular beginning). But I don't use an array - or do I? [...]
The array package extends the capabilites of the array as well as the tabular environment. It is necessary to construct the table like I did in the example. For more information please refer to the package manual. And yes, you do use an array in principal.
timmothey wrote:[...] So what it does is it puts $ Symbols before and after each cell of the first column?! Is it required to have the <{...} thing everytime? So in this case it's clear - yes, but in another context? [...]
That's what it does. And the expression you mentioned is not needed every time. Let's have look at a modified (and thus further optimized) example of your table.

Code: Select all

\begin{tabular}[t]{>{$}c<{$}>{\ttfamily}l@{\,=\,}>{\ttfamily}l}
       & isempty(rest(prefix(a,prefix(b, \textnormal{empty} )))) & false \\
  \iff & isempty(rest(prefix(a,[b]))) & false \\
  \iff & isempty(rest([a,b])) & false \\
  \iff & isempty([b]) & false \\
  \iff & false & false\ $\checkmark$
\end{tabular}
As you can see, you need to put the font family switch only in front of a column. In case of an environment you need to close it after the column as shown with the in-line math environment.
timmothey wrote:[...] I read something about this [t]: It is something like the anchor. If I use t it uses the first row of the table as anchor, otherwise (if b is given) the last one.
But what is the anchor for? That is something I couldn't figure out (maybe because of missing knowledge how to interpret manuals). [...]
I thought that I clarified that in my last reply. In your question lies already the answer. The anchor is for alignment with respect to the current line. It seems that you have to improve your skills regarding the interpretation of manuals. Those manuals describe things better than anybody else could ever do.
timmothey wrote:[...] In CTAN (nice source - thanks for that) I couldn't find tabular but tabulary what was inapprehensible to me. Is there another keyword I can look for (in this special source)? [...]
Since I don't know what you are specifically looking for, I can only refer you to the TeX Catalogue [1]. It lists all necessary stuff that might be useful.

[1] The TeX Catalogue Online, Topic Index - Tables
Post Reply