When I compile this document using pdflatex
, my chapter's (and sections and subsections, too) titles are, respectively, blue (here defined as 'azzurro') and gold.
I would like that all titles and subtitles be black.
This is the document:
\documentclass[envcountsame,envcountchap]{svmono}
%\usepackage[latin1]{inputenc}
\usepackage[utf8]{inputenc}
\usepackage{eurosym}
\usepackage{makeidx} % allows index generation
\usepackage{graphicx} % standard LaTeX graphics tool
\usepackage{xtab} % when including figure files
\usepackage{multicol}
\usepackage{qtree}
\usepackage{booktabs}
\usepackage{latexsym}
\usepackage{psfig} % used for the two-column index
\usepackage[bottom]{footmisc} % places footnotes at page bottom
\usepackage[italian]{babel}
\usepackage{my_listings}
\usepackage[hyphens]{url}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{multirow}
\usepackage{xcolor}
\usepackage{float}
\usepackage{titlesec}
\usepackage{csquotes}
\usepackage{python}
\usepackage{verbatim}
\usepackage{eurosym}
\usepackage[figuresright]{rotating}
\usepackage{pdflscape}
\usepackage{tcolorbox}
%\setcounter{secnumdepth}{3}
%\setcounter{tocdepth}{3}
\makeatletter
\titleformat{\section}[display]%
{\Large\bfseries\boldmath}{\color{azzurro}{\thesection}}{-1.1em}{\hspace{2em}\color{azzurro}}[{\titlerule[0pt]}]
\makeatother
\makeatletter
\titleformat{\subsection}[display]%
{\large\bfseries\boldmath}{\color{gold}{\thesubsection}}{-1em}{\hspace{3em}\color{gold}}[{\titlerule[0pt]}]
\makeatother
\makeatletter
\titleformat{\subsubsection}[display]%
{\normalsize\bfseries\boldmath}{\color{gold}{\thesubsubsection}}{-1em}{\color{gold}}[{\titlerule[0pt]}]
\makeatother
\definecolor{gold}{rgb}{0.64,0.54,0.29}
\definecolor{azzurro}{rgb}{0,0.29,0.57}
\def\lstlistlistingname{\textbf{Elenco dei listati}}
\addto\captionsitalian{\renewcommand{\contentsname}{\textbf{Indice}}}
\addto\captionsitalian{\renewcommand{\listfigurename}{\textbf{Elenco delle figure}}}
\makeatletter
\let\old@rule\@rule
\def\@rule[#1]#2#3{\textcolor{gold}{\old@rule[#1]{#2}{#3}}}
\makeatother
\setlength{\textwidth}{12.7cm}
\setlength{\textheight}{20.0cm}
\setlength{\oddsidemargin}{3.50cm}
\setlength {\evensidemargin}{-0.3cm}
\setlength {\topmargin}{-1cm}
\makeindex
\author{}
\date{13 marzo 2018}
\begin{document}
\pagenumbering{{\color{azzurro}Roman}}
%\include{frontespizio/frontespizio}
%\newpage\null\thispagestyle{empty}\newpage
%\include{dedica/dedica}
%\tableofcontents \listoffigures
%\lstlistoflistings
\pagenumbering{arabic} \setcounter{page}{1}
%\include{Introduzione/introduzione}
\include{01-IlCrowdsourcing/capitolo-01}
%\include{02-LaSentimentAnalysis/capitolo-02}
%\include{03-ProgettazioneDeiTaskDiBase/capitolo-03}
%\include{04-ImplementazioneDeiTaskDiBaseERisultati/capitolo-04}
%\include{05-ProgettazioneDeiTaskAvanzati/capitolo-05}
%\include{06-ImplementazioneDeiTaskAvanzatiERisultati/capitolo-06}
%\include{07-ConfrontoConApprocciCorrelati/capitolo-07}
%\include{08-DiscussioneInMeritoAll'attivitàSvolta/capitolo-08}
\nocite{*}
%\bibliography{Bibliografia/biblio}
\bibliographystyle{plain}
%\include{Ringraziamenti/ringraziamenti}
\end{document}
In this way the file is compiled like the attached image.
When I replace the colors with 'black' as
\definecolor{black}{rgb}{0,0,0}
it give me these errors:
Package xcolor Error: Undefined color gold
Package xcolor Error: Undefined color azzurro
What I can do?
Best Answer
Observe that you are using
\color{azzurro}
(twice: one for counter and other for title) in the definition of\subsection
.So just replace
azurro
byblack
or even better delete\color{azzurro}
, sinceblack
is the default color.Do the same in the definition of
\subsection
.A bad but faster solution would be to keep the definitions and just change RGB values to the color named
azurro
, ie,\definecolor{azzurro}{rgb}{0,0,0}
. With that you will get a blackazurro
.Finally, the error
Package xcolor Error: Undefined color gold
you got was because you had changed the name of the defined color (gold
byblack
) but you were still using thegold
color in codes above. This is why undefined color error.