Text Formattingenumitem | Horizontal Spacing in List Items

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

enumitem | Horizontal Spacing in List Items

Post by sw3quant »

I am using the enumitem package as per below. This gives me two bullet points, that are nicely compacted together.

Code: Select all

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

\begin{document}
 \begin{itemize}[noitemsep,nolistsep]  
{\setlength\itemindent{50pt} \item blah}
{\setlength\itemindent{50pt} \item blah}
 \end{itemize}
\end{document}
However, there is a lot of white space between the bullet point and the start of the text (blah in my example). How do I get rid of or minimize this horizontal white space?

Having played around with the setting as per the package documentation, I can't see any settings to do this.


thanks

Recommended reading 2024:

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

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

hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

enumitem | Horizontal Spacing in List Items

Post by hugovdberg »

Do you mean the spacing before or after the bullet? If I try this I get no unusual amount of whitespace, except before the bullet, as expected because of the setlength.

Below the complete MWE to make sure it compiles and added a section to see the indent before the bullet.

Code: Select all

\documentclass{scrartcl}

\usepackage{enumitem}
\begin{document}
\section{test}
 \begin{itemize}[noitemsep,nolistsep]  
{\setlength\itemindent{50pt} \item blah}
{\setlength\itemindent{50pt} \item blah}
 \end{itemize}
\end{document}
If you want to remove the space before the bullets simply change the lines {\setlength\itemindent{50pt} \item blah} to \item blah
Attachments
enumitem.pdf
(24.73 KiB) Downloaded 1103 times
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

enumitem | Horizontal Spacing in List Items

Post by sw3quant »

thanks for your reply.

uhmm. mine looks different to that!

I mean the space between the bullet point and the "b" of blah. I get an awful lot of white space.

I attach an example. Unfortunatly I am using it in a more complex setting as per below, though I didnt think that would matter?

many thanks for your kind time and help!!


Code: Select all

\begin{algorithm}[H]
    \caption{blah}
    \begin{algorithmic}[1]

                    \IF{(\begin{itemize}[noitemsep,nolistsep]                   % uses enumitem
                                      {\setlength\itemindent{50pt} \item blah}
                                      {\setlength\itemindent{50pt} \item blah}
\ENDIF

    \end{algorithmic}
\end{algorithm}
Attachments
test.jpg
test.jpg (5.73 KiB) Viewed 31964 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

enumitem | Horizontal Spacing in List Items

Post by localghost »

Check your version of enumitem, update your TeX system if necessary and do the settings properly.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{enumitem}

\begin{document}
  Preceding text.
  \begin{itemize}[noitemsep,nolistsep,itemindent=50pt]
    \item Foo
    \item Bar
  \end{itemize}
  Following text.
\end{document}
For details please refer to the package manual. And please get used to always providing a self-contained but minimal example to give an adequate problem description.


Thorsten
Attachments
enumitem-item-indentation.png
enumitem-item-indentation.png (3.57 KiB) Viewed 31959 times
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

enumitem | Horizontal Spacing in List Items

Post by sw3quant »

Yes the packages are the latest ver:

ok. afraid I can only replicate the exact behaviour by including a bit more code:

Code: Select all

\documentclass[11pt]{article}
%%%%%%%%%%%
\usepackage{nicefrac}
\usepackage{mathdots}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{mathtools}
\usepackage{amsmath,amssymb}
\usepackage{amsfonts}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{algorithmwh}
\usepackage{float}
\usepackage{xspace}
\usepackage{verbatim}
\usepackage[T1]{fontenc}
\usepackage{prettyref}
\usepackage{url}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{array}
\usepackage{pifont}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{capt-of}
\usepackage{enumitem}
\usepackage{rotating}
\usepackage{color}
\usepackage{array}
\usepackage{longtable}
\usepackage{calc}
\usepackage{multirow}
\usepackage{hhline}
\usepackage[framed,numbered]{mcode}
\usepackage{ifthen}
\usepackage{lscape}
\usepackage{cite}
\usepackage{lettrine}
\usepackage[active]{srcltx}
\usepackage{hyperref} %this needs to go last because of package interaction
\makeatletter
\makeatother
\newcommand{\tickNo}{\hspace{1pt}\ding{55}}
\newcommand{\tickYes}{\checkmark}
\newcommand{\head}[1]{\textbf{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

\begin{document}
Preceding text.
\begin{itemize}[noitemsep,nolistsep,itemindent=50pt]
\item Foo
\item Bar
\end{itemize}
Following text.

\begin{algorithm}[H]
    \caption{blah}
    \begin{algorithmic}[1]
    \label{FWD}
    \STATE $k=1$        \COMMENT{Initialize counter}
    \FOR{$t = 1 : T$}
        \IF{f}
            \STATE $[ff, ff, ff] = ff(t)$
            \FOR{$i = t : t + dt$}
                \IF{f}
                \STATE $[ff, ff, ff] = ff(i)$
                    \IF{(\begin{itemize}[noitemsep,nolistsep,itemindent=50pt]                   % uses enumitem
                                       \item $dV(t) \ge f$
                                       \item $ff == f$
                                       \item $ff == f$
                                       \item $f == 1$
                                       \item $f \ne f$
                        \end{itemize})}
                        \STATE \COMMENT{Is the iff}
                        \STATE $ff = true$
                        \STATE $\lambda = i - t$
                        \STATE $\bm{\Phi}(k) = \left\{t, f, f, size, f, \lambda \right\}$
                        \STATE \COMMENT{f a UID and ensure unique and f}
                        \STATE $\bm{\Phi}(k) = ff(\bm{\Phi})$
                        \STATE $\theta = i - \bm{\Phi}(k)(t)$
                        \STATE $\bm{\Phi}(k) = \left\{\theta \right\}$
                        \IF{$\left(\text{On-ff mode}\right)$}
                            \STATE $\bm{\Gamma} = ff\_ff(\bm{\Phi}(k), \bm{\Theta})$
                        \ENDIF
                        \STATE $k = k + 1$ \COMMENT{Increment counter}
                    \ENDIF
                \ENDIF
            \ENDFOR
        \ENDIF
    \ENDFOR
    \end{algorithmic}
\end{algorithm}


\end{document} 
Attachments
test4.jpg
test4.jpg (47.28 KiB) Viewed 31953 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

enumitem | Horizontal Spacing in List Items

Post by localghost »

Are you familiar with the term "minimal"? If not, read this single post. m(
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

enumitem | Horizontal Spacing in List Items

Post by sw3quant »

As I explained I can not replicate the behaviour without putting in more code.

For example this works fine:

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\usepackage[T1]{fontenc}
\usepackage{prettyref}
\usepackage{url}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{xcolor}
\usepackage{amsfonts}
\usepackage{nicefrac}
\usepackage{capt-of}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{algorithmwh}
\usepackage{float}
\usepackage{xspace}
\usepackage{verbatim}
\usepackage{mathdots}
\usepackage{bm}
\usepackage{amsmath,amssymb}

\begin{document}
Preceding text.
\begin{itemize}[noitemsep,nolistsep,itemindent=50pt]
\item Foo
\item Bar
\end{itemize}
Following text.

\begin{algorithm}[H]
\begin{algorithmic}[1]
\STATE 1
\IF{
(\begin{itemize}[noitemsep,nolistsep,itemindent=50pt]                   % uses enumitem
       \item $blah$
       \item $blah$
\end{itemize})
}
\STATE 1
\ENDIF
\end{algorithmic}
\end{algorithm}


\end{document} 
hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

enumitem | Horizontal Spacing in List Items

Post by hugovdberg »

Unfortunately this example does not compile on my computer since I don't have packages algorithmwh and mcode. I do, however, confirm your troubles. It seems to be a problem with the \IF/\ENDIF and \FOR/\ENDFOR commands. Every step the indentation increases the space after the bullet increases, unfortunately I'm not very familiar with algorithms in LaTeX so I hope someone else knows how to solve this or that this information is enough for you to solve it yourself.

Below a real Infominimal working example, excluding the unnecessary packages and lines. When commenting more IFs and FORs the unwanted white space decreases.

Code: Select all

\documentclass[11pt]{article}
%%%%%%%%%%%
\usepackage{bm}
\usepackage{mathtools}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage[T1]{fontenc}
\usepackage{array}
\usepackage{enumitem}

\begin{document}
Preceding text.
\begin{itemize}[noitemsep,nolistsep,itemindent=50pt]
\item Foo
\item Bar
\end{itemize}
Following text.

\begin{algorithm}[H]
    \caption{blah}
    \begin{algorithmic}[1]
    \label{FWD}
    \FOR{$t = 1 : T$}
        \IF{f}
            \FOR{$i = t : t + dt$}
%                \IF{f}
                    \IF{(\begin{itemize}[noitemsep,nolistsep,itemindent=50pt]                   % uses enumitem
                                       \item $dV(t) \ge f$
                        \end{itemize})}
                        \STATE \COMMENT{Is the iff}
                    \ENDIF
 %               \ENDIF
            \ENDFOR
        \ENDIF
    \ENDFOR
    \end{algorithmic}
\end{algorithm}

\end{document}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

Re: enumitem | Horizontal Spacing in List Items

Post by sw3quant »

thank you for your thoughts on this. very helpful.

As you can see I wish to include a set of five conditions in an IF statement, and I thought using bullet points might be a clear way of doing it.

Can you suggest another way in which I can present 5 conditions in an IF statement.

In real code of course it goes "IF(a==b && d==e && e>=g && h<y && r==q)", though in latex that will look poor and unclear to the reader. I also am writing for a double col. journal, which means I have even less space.
Post Reply