
Eu procurei e procurei aqui por uma possível resposta, mas estou ficando aquém. Eu até mencionei as instruções do titlesec .pdf e ainda não tenho ideia. Estou tendo um problema no \chapter
corpo principal, dizendo que está faltando um zero.
Chapter 1.
! Missing number, treated as zero.
<to be read again>
\relax
l.39 \chapter{Spanning Tree Protocol Concepts}
O erro está no meu primeiro capítulo.
Estou digitando minhas anotações e para cada capítulo quero exibir "capítulo 1" e então "este é o título do capítulo" As seções que não quero numeradas, é por isso que uso um arquivo \section*
. Alguma ideia?
\documentclass{report}
\usepackage[letterpaper,margin=1in]{geometry}
%\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage{bookmark}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{parskip}
%\usepackage{indentfirst} used to indent first paragraph
%%%CHAPTER FORMAT/SPACING
\titleformat{\chapter}[display] %cmd and shape
{\normalfont\LARGE\bfseries} %textformat \typeoffont\size\ifits bold?
{Chapter \thechapter}%Label
{1pt} %seperaton from num to title name
{} %before code (blank means default)
\titlespacing{\chapter}{}{}{4pt} %cmd left margin befoe titel and after title
%%%SECTION FROMAT/SPACING
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{}{}
\titlespacing{\section}{}{5pt}{5pt}
\linespread{0.7}
\setlist{nosep}
\setlength{\intextsep}{1pt}
\setlength{\parskip}{0pt}
\begin{document}
%\maketitle{ICND2 Note}
\part{LAN Switching}
\chapter{Spanning Tree Protocol Concepts}
\section*{Spanning Tree Protocol IEEE 802.1}%\pdfbookmark{STP} {ch:1:sec:2}
-Prevents loops when redundant links are used\\
-STP main goals
\begin{enumerate}
\item All devices in a VLAN can send frames to all others
\item Frames do not loop around (short life)
\end{enumerate}
-Checks each interface before send and receiving to prevent loops \\
-Consist of 2 states \textbf{Forwarding} \& \textbf{Blocking}
\section*{The Need for Spanning Tree} %\\pdfbookmark{Need for STP}
/end{document}
Responder1
O comando \titlespacing
espera três comprimentos.
então eles deveriam ser algo como
\titlespacing{\chapter}{0pt}{0pt}{4pt}
e
\titlespacing{\section}{0pt}{5pt}{5pt}
Além disso, você tem /end{document}
em vez de\end{document}
Não sei o que você está tentando alcançar, mas este é o seu MWE modificado:
\documentclass{report}
\usepackage[letterpaper,margin=1in]{geometry}
%\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage{bookmark}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{parskip}
%\usepackage{indentfirst} used to indent first paragraph
%%%CHAPTER FORMAT/SPACING
\titleformat{\chapter}[display] %cmd and shape
{\normalfont\LARGE\bfseries} %textformat \typeoffont\size\ifits bold?
{Chapter \thechapter}%Label
{1pt} %seperaton from num to title name
{} %before code (blank means default)
\titlespacing{\chapter}{0pt}{0pt}{4pt} %cmd left margin befoe titel and after title
%%%SECTION FROMAT/SPACING
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{1em}{}
\titlespacing{\section}{0pt}{5pt}{5pt}
\linespread{0.7}
\setlist{nosep}
\setlength{\intextsep}{1pt}
\setlength{\parskip}{0pt}
\begin{document}
%\maketitle{ICND2 Note}
\part{LAN Switching}
\chapter{Spanning Tree Protocol Concepts}
\section*{Spanning Tree Protocol IEEE 802.1}%\pdfbookmark{STP} {ch:1:sec:2}
-Prevents loops when redundant links are used\\
-STP main goals
\begin{enumerate}
\item All devices in a VLAN can send frames to all others
\item Frames do not loop around (short life)
\end{enumerate}
-Checks each interface before send and receiving to prevent loops \\
-Consist of 2 states \textbf{Forwarding} \& \textbf{Blocking}
\section*{The Need for Spanning Tree} %\\pdfbookmark{Need for STP}
\end{document}
Saída
Observe que também está faltando um comprimento em
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{}{}
Deveria ser algo como
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{1em}{}
Você simplesmente não percebeu isso porque no MWE você só tem seções não numeradas.
Responder2
Eu sugeriria uma pequena melhoria: suas linhas que começam com um hífen têm uma estrutura de itens, então eu costumava enumitem
formatar itemize
com endash
es. Faltava um comprimento como o quarto argumento de \titleformat{\section}{…}
:
\documentclass{report}
\usepackage[letterpaper,margin=1in]{geometry}
%\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage{bookmark}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{parskip}
%\usepackage{indentfirst} used to indent first paragraph
\setlist[itemize, 1]{rótulo = \textendash}
%%%CHAPTER FORMAT/SPACING
\titleformat{\chapter}[display] %cmd and shape
{\normalfont\LARGE\bfseries} %textformat \typeoffont\size\ifits bold?
{Chapter \thechapter}%Label
{1pt} %seperation from num to title name
{} %before code (blank means default)
\titlespacing{\chapter}{0pt}{0pt}{4pt} %cmd left margin befoe titel and after title
%%%SECTION FORMAT/SPACING
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{0.5em}{}
\titlespacing{\section}{0pt}{5pt}{5pt}
\linespread{0.7}
\setlist{nosep}
\setlength{\intextsep}{1pt}
\setlength{\parskip}{0pt}
\begin{document}
%\maketitle{ICND2 Note}
\part{LAN Switching}
\chapter{Spanning Tree Protocol Concepts}
\section*{Spanning Tree Protocol IEEE 802.1}%\pdfbookmark{STP} {ch:1:sec:2}
\begin{itemize}[wide = 0pt]
\item Prevents loops when redundant links are used
\item STP main goals
\begin{enumerate}[wide = 1.9em, leftmargin=3.15em]
\item All devices in a VLAN can send frames to all others Text text text text text text text text text text text text text text text text text text text text text text
\item Frames do not loop around (short life)
\end{enumerate}
\item Checks each interface before send and receiving to prevent loops
\item Consist of 2 states \textbf{Forwarding} \& \textbf{Blocking}
\end{itemize}
\section*{The Need for Spanning Tree} %\\pdfbookmark{Need for STP}
\end{document}