2

I am trying to use tcolorbox to highlight some words in a paper so I use this:

\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\tcbuselibrary{listings,breakable}
\newtcbox{\mybox}[2][]{nobeforeafter,tcbox raise base,colframe=#2,colback=#2!10!white,top=0.8pt,bottom=0.8pt, left=0.8pt, right=0.8pt,before upper=\strut}
% part of speech tagging
\newtcbox{\pstag}[2][]{nobeforeafter,tcbox raise base,colframe=#2,colback=#2,top=0.8pt,bottom=0.8pt, left=0.8pt, right=0.8pt,before upper=\strut}

This is working just fine in another document \mybox{WildStrawberry}{her \pstag{WildStrawberry}{\scriptsize PRONOMINAL}}

enter image description here

When I try to integrate this into another document I get some errors because of the titleformat commands. ! Missing number, treated as zero.} \chapter{Introduction}

\usepackage{textcase}
\usepackage[titletoc, title]{appendix}
\usepackage{titlesec}
\titleformat{\chapter}{\large\bfseries\MakeUppercase}{\thechapter}{2ex}{}[\vspace*{-1.5cm}]
\titleformat*{\section}{\large\bfseries}
\titleformat*{\subsection}{\large\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}

So if I comment the \titleformat I have no errors, and I can use my colored boxes. But I need these title formats. Can someone provide a different solution?

Edit - added code for the document causing the error. There are some parts missing because is from my bachelor thesis (but the templates definitions are complete)

\documentclass[12pt,a4paper,dvipsnames]{report}

\usepackage[utf8]{inputenc} 
\usepackage[romanian]{babel} 
\renewcommand\familydefault{\sfdefault} % sans serif

\usepackage[margin=2.54cm]{geometry}    
\usepackage{graphicx} % support the \includegraphics command and options


\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\tcbuselibrary{listings,breakable}
\newtcbox{\mybox}[2][]{nobeforeafter,tcbox raise base,colframe=#2,colback=#2!10!white,top=0.8pt,bottom=0.8pt, left=0.8pt, right=0.8pt,before upper=\strut}
% part of speech tagging
\newtcbox{\pstag}[2][]{nobeforeafter,tcbox raise base,colframe=#2,colback=#2,top=0.8pt,bottom=0.8pt, left=0.8pt, right=0.8pt,before upper=\strut}


% formatting sections and subsections
\usepackage{textcase}
\usepackage[titletoc, title]{appendix}
\usepackage{titlesec}
%\titleformat{\chapter}{\large\bfseries\MakeUppercase}{\thechapter}{2ex}{}[\vspace*{-1.5cm}]
%\titleformat*{\section}{\large\bfseries}
%\titleformat*{\subsection}{\large\bfseries}
%\titleformat*{\subsubsection}{\large\bfseries}

\usepackage{chngcntr}
\counterwithout{figure}{chapter} % no chapter number in figure labels
\counterwithout{table}{chapter} % no chapter number in table labels
\counterwithout{equation}{chapter} % no chapter number in equation labels

\usepackage{booktabs} % for much better looking tables
\usepackage{url} % Useful for inserting web links nicely
\usepackage[bookmarks,unicode,hidelinks]{hyperref}

\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
\usepackage{enumitem}
\setlist{noitemsep}

%%%%%%%%%%%%%%

%%% HEADERS & FOOTERS
\usepackage{fancyhdr}
\pagestyle{empty}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{}\chead{}\rhead{}
\lfoot{}\cfoot{\thepage}\rfoot{}



\newcommand{\HeaderLineSpace}{-0.5cm}
\newcommand{\UniTextRO}{UNIVERSITATEA POLITEHNICA DIN BUCUREȘTI \\[\HeaderLineSpace] 
FACULTATEA DE AUTOMATICĂ ȘI CALCULATOARE \\[\HeaderLineSpace]
DEPARTAMENTUL CALCULATOARE\\}
\newcommand{\DiplomaRO}{PROIECT DE DIPLOMĂ}
\newcommand{\AdvisorRO}{Coordonator științific:}
\newcommand{\BucRO}{BUCUREȘTI}

\newcommand{\UniTextEN}{UNIVERSITY POLITEHNICA OF BUCHAREST \\[\HeaderLineSpace]
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS \\[\HeaderLineSpace]
COMPUTER SCIENCE DEPARTMENT\\}
\newcommand{\DiplomaEN}{DIPLOMA PROJECT}
\newcommand{\AdvisorEN}{Thesis advisor:}
\newcommand{\BucEN}{BUCHAREST}

\newcommand{\frontPage}[6]{
\begin{titlepage}
\begin{center}
{\Large #1}  % header (university, faculty, department)
\vspace{50pt}
\begin{tabular}{p{6cm}p{4cm}}
\includegraphics[scale=0.8]{pics/upb-logo.jpg} &
    \includegraphics[scale=0.5,trim={14cm 11cm 2cm 5cm},clip=true]{pics/cs-logo.pdf}
\end{tabular}

\vspace{105pt}
{\Huge #2}\\                           % diploma project text
\vspace{40pt}
{\Large #3}\\ \vspace{0pt}  % project title
{\Large #4}\\                          % project subtitle
\vspace{40pt}
{\LARGE \Name}\\                   % student name
\end{center}
\vspace{60pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}p{6cm}r}
&{\large\textbf{#5}}\vspace{10pt}\\      % scientific advisor
&{\large \Advisor}                                    % advisor name
\end{tabular*}
\vspace{20pt}
\begin{center}
{\large\textbf{#6}}\\                                % bucharest
\vspace{0pt}
{\normalsize \Year}
\end{center}
\end{titlepage}
}

\newcommand{\frontPageRO}{\frontPage{\UniTextRO}{\DiplomaRO}{\ProjectTitleRO}{\ProjectSubtitleRO}{\AdvisorRO}{\BucRO}}
\newcommand{\frontPageEN}{\frontPage{\UniTextEN}{\DiplomaEN}{\ProjectTitleEN}{\ProjectSubtitleEN}{\AdvisorEN}{\BucEN}}

\linespread{1.5}
\setlength\parindent{0pt}
\setlength\parskip{.28cm}

%% Abstract macro
\newcommand{\AbstractPage}{
\begin{titlepage}
\textbf{\large SINOPSIS}\par
\AbstractRO\par\vfill
\textbf{\large ABSTRACT}\par
\AbstractEN \vfill
\end{titlepage}
}

%% Thank you macro
\newcommand{\ThanksPage}{
\begin{titlepage}
{\noindent \large\textbf{MULȚUMIRI}}\\
\Thanks
\end{titlepage}
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
%%
%%          End of template definitions
%%   
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\frontPageRO
\frontPageEN

\begingroup
\linespread{1}
\tableofcontents
\endgroup

\AbstractPage

\chapter{Introducere}\pagestyle{fancy}


 I: Mrs. \mybox{WildStrawberry}{\mybox{YellowGreen}{Robinson \pstag{YellowGreen}{\scriptsize PROPER}}'s phone
 \end{document}
2
  • 2
    Welcome to TeX SX! I've never heard of a conflict between these two packages. Could you post a minimal, yet complete, code illustrating your problem?
    – Bernard
    Jun 12, 2019 at 19:50
  • @Bernard I edited my post and added the code causing the problem.
    – Dana Nica
    Jun 12, 2019 at 20:31

1 Answer 1

1

You are placing \MakeUppercase in the wrong place:

\titleformat{\chapter}{\large\bfseries}{\thechapter}{2ex}{\MakeUppercase}[\vspace*{-1.5cm}]
1
  • thank you very much, it worked. I don't understand why I only got the error after I added code for the colored text boxes.
    – Dana Nica
    Jun 12, 2019 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .