Text FormattingEnumitem

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
diazdeus
Posts: 32
Joined: Fri Sep 28, 2018 9:34 pm

Enumitem

Post by diazdeus »

Hi.
I need in a document diferent types of lists labels, with the posibility to change the label aspect beetween sections. For example, in a section I need enumeration like this:
1.-- One.
2.-- Two.
a) First.
b) Second.
3.-- Three.
....
But in the next section I need:
1.-- One.
1.1.-- First.
1.2.-- Second.
2.-- Two.
2.1.-- One.
2.2.-- Two.
2.3.-- Three.
...

I use the code,
\setlist[enumerate,1]{label=\bf{\arabic*.}--}
for the first list (the level 2 in enumerate is a), b), etc. by default) and the pdf output is ok. But I am be unable to find the code for the second enumerate list.

In adition, I have error if I use this code,
\setlist[itemize,1]{label=\emph{\alph*})}
for the first level of itemize (this is the same label than the level Nº 2 in enumerate).

I have \usepackage{enumitem} in the document with this preamble:

\usepackage{etex}
\reserveinserts{28}
\setcounter{chapter}{61}
\usepackage[pagestyles]{titlesec}
\usepackage{ifthen}
\usepackage{array}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{longtable}
\usepackage{fnpos}
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage{slashbox}
\usepackage{pict2e}
\usepackage{multirow}
\usepackage{float}
\floatplacement{table}{tp}
\usepackage{morefloats}
\usepackage{flafter}
\usepackage{floatflt}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{enumitem}
\usepackage{nccparskip}
\usepackage{eso-pic,everyshi,calc}
\usepackage{dashrule}
\usepackage{marvosym}
\usepackage{amsbsy}
\usepackage{yhmath}
\usepackage{txfonts}
\usepackage{textcomp}
\usepackage{mathcomp}
\usepackage{gensymb}
\usepackage[e]{esvect}
\usepackage[spanish,es-nodecimaldot]{babel}
\usepackage{ccaption}
\usepackage[labelsep=endash,font={small,it},labelformat=simple,labelfont=bf,figurewithin=none,justification=centering]{caption}
\usepackage{nowidow}
\usepackage{subcaption}

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\ifnum\value{section}<10 \arabic{chapter}0\arabic{section}\else\arabic{chapter}\arabic{section}\fi}
\renewcommand{\sin}{\sen \nolimits}
\renewcommand{\arcsin}{\arcsen \nolimits}
\renewcommand{\sinh}{\senh \nolimits}
\renewcommand{\tan}{\tg \nolimits}
\renewcommand{\arctan}{\arctg \nolimits}
\renewcommand{\tanh}{\tgh \nolimits}
\renewcommand{\csc}{\cosec \nolimits}
\renewcommand{\cot}{\cotg \nolimits}
\renewcommand{\lg}{\log \nolimits}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\renewcommand{\thetable}{\arabic{table}}

\addto\captionsspanish{\renewcommand{\figurename}{Fig.}}
\addto\captionsspanish{\renewcommand{\tablename}{Tabla}}

\DeclareMathOperator{\gs}{\textrm{\!\textdegree}}
\DeclareCaptionLabelFormat{tabla}{#2}

\titleformat{\chapter}[display]
{\Large\bfseries\fillast\vspace{-25pt}}
{\normalfont\bfseries\chaptername\hspace{5pt}\thechapter}
{.5ex minus .1ex}
{\large}[\vspace{-15pt}]

\titleformat{\section}[runin]
{\normalfont\bfseries}
{\thesection.}{.5em}{}[.---\:]

\titlespacing{\section}
{\parindent}{1.5ex plus .1ex minus .2ex}{0pt}

\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

\usepackage[bookmarks=true,bookmarksopen=true,bookmarksopenlevel=2,bookmarksnumbered=true,breaklinks=true]{hyperref}
\renewcommand{\frac}[2]{\genfrac{}{}{0.1pt}{}{#1}{#2}}
\renewcommand{\dfrac}[2]{\genfrac{}{}{0.1pt}{}{#1}{#2}}
\renewcommand{\cfrac}[2]{\genfrac{}{}{0.1pt}{}{#1}{#2}}
\renewcommand{\tfrac}[2]{\genfrac{}{}{0.1pt}{}{#1}{#2}}
\setlength\fboxrule{.1pt}

Thanks for to read me.

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

diazdeus
Posts: 32
Joined: Fri Sep 28, 2018 9:34 pm

Enumitem

Post by diazdeus »

Hi.

I have a reply to my post. The solution to one of my questions is to include this code before the list:

\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{\bf{\arabic{enumi}.\arabic{enumii}.}--}

Thanks.
diazdeus
Posts: 32
Joined: Fri Sep 28, 2018 9:34 pm

Enumitem

Post by diazdeus »

But the same commands don't work to itemize:

\renewcommand{\labelitemi}{\arabic{itemi}.}
\renewcommand{\labelitemii}{\arabic{itemi}.\arabic{itemii}.--}
Post Reply