Text FormattingAdjust spacing between item and text in itemize environment?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
KALogic
Posts: 3
Joined: Mon Aug 24, 2020 9:36 am

Adjust spacing between item and text in itemize environment?

Post by KALogic »

I wish to adjust the amount of horizontal spacing between the item label and the item text in the itemize environment, and further, keep the item label left aligned. Here's an example code:

Code: Select all

\begin{itemize}[align=left]
\item[\textrm{[1]}] Let z1 and z2 be complex numbers, where z2 is not equal to zero. Then ... 
\end{itemize}
The result is, to my taste, to much spacing between the text "Let z1 and z2 ..." and the item label "[1]"
Last edited by cgnieder on Tue Aug 25, 2020 8:53 am, edited 1 time in total.

Recommended reading 2024:

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

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

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Adjust spacing between item and text in itemize environment?

Post by Ijon Tichy »

If you are using enumitem you can also change the leftmargin, the labelwidth and/or the labelsep.

BTW: It seems this should be a enumerated list. If this is true, I would recommend enumerate with automatic numeration instead if itemize.

If this answer is not enough so solve your problem, please show a Infominimal working example instead of a code snippet.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
KALogic
Posts: 3
Joined: Mon Aug 24, 2020 9:36 am

Adjust spacing between item and text in itemize environment?

Post by KALogic »

Ijon Tichy wrote:If you are using enumitem you can also change the leftmargin, the labelwidth and/or the labelsep.

BTW: It seems this should be a enumerated list. If this is true, I would recommend enumerate with automatic numeration instead if itemize.

If this answer is not enough so solve your problem, please show a Infominimal working example instead of a code snippet.
Thanks Ijon!

Yes, but I want to keep the enumeration in brackets, like this [1] or [23], and sometimes I use other labels like [*] or [1'']. And if I switch to the enumerate environment instead of itemize (but still use the [align=left] option), the visual result is identical.

Yes, I use the enumitem package.

Here's a minimal working example

Code: Select all

\documentclass[12pt, a4paper]{article}

\usepackage[parfill]{parskip}
\usepackage{setspace}
\setstretch{1.1}

\usepackage[swedish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{amsmath, amsthm, amssymb}
\usepackage[all]{xy}

\usepackage{enumitem}

%\setitemize{align=left}  I don't always wish to do this adjustment globally in my documents

\newcounter{propnr}
\addtocounter{propnr}{0}

\begin{document}

\begin{itemize}[align=left]
\item[\textbf{[\stepcounter{propnr}\arabic{propnr}]}] \emph{Lorem ipsum ... thus ... }
\end{itemize}

\end{document}
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Adjust spacing between item and text in itemize environment?

Post by Ijon Tichy »

enumitem also provides attributes to modify the formatting of the number of an enumeration. And as I already told, there are attributes like leftmargin, labelwidth and labelsep to modify the indent and alignment of label and item text. Figure 1 in the manual is very useful to understand these attributes. And automatic values like * and ! are also useful and explained in the manual.

Code: Select all

\documentclass[12pt,a4paper]{article}
     
\usepackage{enumitem}
     
\usepackage{mwe,showframe}% only for demonstration purpose
\begin{document}
     
\begin{enumerate}[align=left,label=\textbf{[\arabic{*}]},leftmargin=0pt,labelwidth=!,labelsep=.5em]
\item \emph{\blindtext}
\end{enumerate}

\begin{enumerate}[label=\textbf{[\arabic{*}]},leftmargin=1.5em,labelsep=*]
\item \emph{\blindtext}
\end{enumerate}
\end{document}
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
KALogic
Posts: 3
Joined: Mon Aug 24, 2020 9:36 am

Adjust spacing between item and text in itemize environment?

Post by KALogic »

Thanks Ijon! Perfect, that should do it!
Post Reply