2

I am writing my thesis using xelatex. I use TikZ package to make figures. Although when I check my pdf it makes figures correctly, but it gives following error

"! Missing { inserted."

And section title disappears everywhere, although subsection titles are showing. For the clarity, I have added the main file of code of my thesis. If I remove tikz package then code runs fine, except that the figures are not generated. The problem is only with the tikz package, I have checked it several times.

\documentclass[twoside,11pt,bibliography=totoc, fleqn,enabledeprecatedfontcommands]{scrbook}

 \usepackage{fontspec}

 \defaultfontfeatures{Ligatures=TeX}

 \usepackage{scrpage2}

\ifoot[]{}
\cfoot[\pagemark]{\pagemark}
\ofoot[]{}
\pagestyle{scrplain}
\renewcommand*{\pnumfont}{\normalfont \sffamily\fontsize{10}{10}\bfseries}

\setlength{\parskip}{11pt} % 1ex plus 0.5ex minus 0.2ex}

\setlength{\parindent}{0.5in} % paragraph left indentation

\usepackage{indentfirst} % to set indent for first paragraph

\usepackage{tikz}


\usepackage[a4paper, 
left=12.5mm,right=12.5mm,top=25mm,bottom=25mm,bindingoffset=19.5mm]{geometry}

\usepackage[small,sf,bf]{titlesec}
\setmainfont[]{Book Antiqua} 

\setsansfont{Candara}
\titleformat{\chapter}[display]
{\normalfont\fontsize{18}{11} \flushright\sffamily \bfseries}{\normalfont 
\fontsize{27}{11}\sffamily \textit \chaptername \thechapter}{0pt}
{\fontsize{27}{11}}

\titleformat{\section}
{\normalfont  \sffamily\bfseries \fontsize{13}{11}\MakeUppercase}
{\sffamily\thesection}{0.2em}{}

\titleformat{\subsection}
 {\normalfont\fontsize{12}{11}\sffamily\bfseries}{\sffamily\thesubsection}
 {0.2em}{}

\titleformat{\subsubsection}
{\normalfont\fontsize{11}{11}\sffamily\bfseries\itshape}
{\sffamily\thesubsection}{0.2em}{}

 \titlespacing*{\chapter} {0pt}{0pt}{44pt}
 \titlespacing*{\section} {0pt}{22pt}{-11pt}
 \titlespacing*{\subsection}{0pt}{11pt}{-11pt}
 \titlespacing*{\subsubsection}{0pt}{11pt}{-11pt}

  \usepackage{mdwlist}

  \usepackage[labelfont=bf,font={normalsize,sf}]{caption}
  \DeclareCaptionLabelSeparator{colon}{ : }
  \captionsetup{labelsep=colon}
   \usepackage{graphicx,subfigure}
   \usepackage{multirow}
   \usepackage{multicol}
   \usepackage{mathptmx}
  \usepackage{amsmath,amssymb,amsthm}
  \usepackage{amsmath}
  \usepackage{algorithm2e}



   \newtheorem{theorem}{\sffamily\textbf{Theorem}\rmfamily}[chapter]
   \newtheorem{proposition}{\sffamily\textbf{Proposition}\rmfamily}[chapter]

    \newtheorem{definition}{\sffamily\textbf{Definition}\rmfamily}[chapter]

    \newtheorem{pro}{\sffamily\textbf{Procedure}\rmfamily}[chapter]

    \newtheorem{example}{\sffamily\textbf{Example}\rmfamily}[chapter]

    \newtheorem{corollary}{\sffamily\textbf{Corollary}\rmfamily}[chapter]
    \newtheorem{lemma}{\sffamily\textbf{Lemma}\rmfamily}[chapter]
   \newtheorem{algo}{\sffamily\textbf{Algorithm}\rmfamily}[chapter]
   \renewenvironment{proof}{\hspace{-35pt}\sffamily 
   \textbf{Proof:}\rmfamily}{}
    \setlength{\mathindent}{1cm}
    \usepackage[titletoc,title]{appendix}

    \usepackage[square]{natbib}
      \renewcommand\bibname{References} % to change name 'Bibliography' to 
   ''References
    \setlength{\bibsep}{0pt} % to force space between references to zero

      \setlength{\textfloatsep}{33pt} %distance between floats on the top or 
     the bottom and the text;
     \setlength{\floatsep}{33pt} %distance between two floats;
   \setlength{\textfloatsep}{33pt} %distance between floats inserted inside 
   the page text (using h) and the text proper
    \setlength{\abovecaptionskip}{11pt} % set space between caption and 
   figure float
    \setlength{\belowcaptionskip}{11pt} % set space between caption and 
   table float


  \usepackage[smaller,style=long3colheader,acronyms,nopostdot,nonumberlist]
 {glossaries}
   \renewcommand*{\glsnamefont}[1]{\textmd{#1}} % make name of the glossary 
      item in normal (bold otherwise) 
       \renewcommand{\glsnamefont}[1]{\sf \textmd{#1}\hspace{30pt}}
       \renewcommand*{\acronymfont}[2]{\textsf{#1}} % for changing font of 
   acronyms
    \renewcommand*{\firstacronymfont}[1]{\emph{#1}}
     \setglossarystyle{long3colheader}
      \renewcommand*{\glossaryheader}{%
       \vspace{11pt} \sf \itshape \fontsize{10}{100} Symbol & \sf \itshape 
      \fontsize{10}{100} Description \\\endhead}



         \renewcommand*{\acronymname}{acronym}
     \renewcommand*{\entryname}{Abbreviation}
    \renewcommand*{\descriptionname}{Full Form}
      \renewcommand*{\pagelistname}{}
    \setlength{\glsdescwidth}{0.9\linewidth}
   \makeglossaries
 \input{listofsymbols/listofsymbols} % .tex file containing glossary entries 
 for symbols
    \input{listofabbreviations/listofabbreviations} % .tex file containing 
    acronym entries for abbriviations

     \usepackage[subfigure,titles]{tocloft}
      \renewcommand{\cftchapfont}{\fontsize{11}{10}\sffamily\bfseries}
      \renewcommand{\cftchappagefont}{\normalfont \fontsize{10}
     {10}\sffamily}
     \renewcommand{\cftchappresnum}{Chapter }
         \renewcommand{\cftchapaftersnum}{:}
      \renewcommand{\cftchapnumwidth}{57pt}
       \renewcommand{\cftsecindent}{0pt}
         \renewcommand{\cftsubsecindent}{24pt}
        \renewcommand{\cftsubsecnumwidth}{26pt}
        \renewcommand{\cftsecfont}{\fontsize{10}{10} \sffamily}
        \renewcommand{\cftsubsecfont}{\normalfont \fontsize{10}{11} 
        \sffamily\itshape}
          \renewcommand{\cftsubsecpagefont}{\normalfont \fontsize{10}{11} 
     \sffamily\itshape}
       \renewcommand{\cftfigfont}{\normalfont \fontsize{10}{10} \sffamily}
      \renewcommand{\cfttabfont}{\normalfont \fontsize{10}{10} \sffamily}
  \renewcommand{\cftdot}{}
    \renewcommand{\cfttoctitlefont}{\normalfont \fontsize{14}{11} 
   \sffamily\bfseries}
      \renewcommand{\cftloftitlefont}{\normalfont \fontsize{14}{11} 
    \sffamily\bfseries}
   \renewcommand{\cftlottitlefont}{\normalfont \fontsize{14}{11} 
    \sffamily\bfseries}
      \cftsetrmarg{60pt}



    \makeatletter
  \newcommand*\updatechaptername{%
    \addtocontents{toc}
      {\protect\renewcommand*\protect\cftchappresnum{Annexure}}
       }
    \makeatother



        \makeatletter
      \newcommand*\updatechapnumafter{%
    \addtocontents{toc}
    {\protect\renewcommand*\protect\cftchapnumwidth{67pt}}
     }
      \makeatother
    \begin{document}
      \include{titlepage/titlepage}
   \frontmatter
       \include{declaration/declaration}
    \include{certificate/certificate}
     \include{abstract/abstract}
    \include{ack/ack}
       \clearpage
       \tableofcontents
       \addtocontents{toc}{\protect \hfill \sffamily \fontsize{10}{10} 
    \textit{page} \par}
      \addtocontents{toc}{\protect \sffamily \fontsize{10}{10} 
      \textit{Abstract} \protect \hfill \protect \sffamily \fontsize{10}
    {10}\textit{i}\par}
     \addtocontents{toc}{\protect \sffamily \fontsize{10}{10} 
       \textit{Acknowledgements} \protect \hfill \protect \sffamily 
     \fontsize{10}{10}\textit{iii}\par}
      \addtocontents{toc}{\protect \sffamily \fontsize{10}{10} 
     \textit{Contents} \protect \hfill \protect \sffamily \fontsize{10}
   {10}\textit{v}\par}
      \addtocontents{toc}{\protect \sffamily \fontsize{10}{10} \textit{List 
     of Figures} \protect \hfill \protect \sffamily \fontsize{10}
    {10}\textit{vii}\par}
    \addtocontents{toc}{\protect \sffamily \fontsize{10}{10} \textit{List of 
     Tables} \protect \hfill \protect \sffamily \fontsize{10}
     {10}\textit{viii}\par}
          \addtocontents{toc}{\protect \sffamily \fontsize{10}{10} 
     \textit{List of Symbols} \protect \hfill \protect \sffamily 
  \fontsize{10}{10}\textit{ix}\par}
    \addtocontents{toc}{\protect \sffamily \fontsize{10}{10} \textit{List of 
     Abbreviations} \protect \hfill \protect \sffamily \fontsize{10}
      {10}\textit{x}\par}

     \renewcommand{\cftfigindent}{10pt}
     \renewcommand{\cftfignumwidth}{37pt}
  \listoffigures


    \addtocontents{lof}{\protect \sffamily\itshape \fontsize{10}{10} Figures 
      \protect\hspace{10pt} Title \protect\hfill\mbox{page}\par}

      \renewcommand{\cfttabindent}{10pt}
     \renewcommand{\cfttabnumwidth}{37pt}
     \listoftables
  \addtocontents{lot}{\protect \sffamily\itshape \fontsize{10}{10} Figures 
   \protect\hspace{10pt} Title \protect\hfill\mbox{page}\par}

    \printglossary[title=List of Symbols]
   \printglossary[type=acronym, title=List of Abbreviations]



     \protect\renewcommand{\chaptername}{}
\mainmatter
  \include{chapter1/chapter1}
   \include{chapter2/chapter2}
     \include{chapter3/chapter3}
 \include{chapter4/chapter4}
  \include{chapter5/chapter5}
    \include{chapter6/chapter6}


   \protect\renewcommand{\chaptername}{Annexure }
 \appendix
 \updatechapnumafter
    \updatechaptername
   \chapter{aa}


     \backmatter


   \bibliographystyle{iitjphd}
     \bibliography{bibliography/references}

 \end{document}
  • 3
    why do you think it is related to tikz? Given the (minimal) information you have provided it would seem to be an error in a section heading, most likely use of a fragile command without \protect – David Carlisle May 27 '17 at 14:16
  • It is certainly related tikz. If I remove tikz package sections are working perfectly fine, although obviously figures will not be generated. – Ranveer Singh May 27 '17 at 14:22
  • 4
    you need to give some hint prefereably a small complete document that shows the problem. There is absolutely nothing in the question that relates to tikz or section headings. So no one will be able to help if you leave the question in that form. – David Carlisle May 27 '17 at 14:32
  • 4
    Like Davis Carlisle says we need a minimal working example. Here you can find more general information and here (MWE related informations). It will make it easier to help you. – Bobyandbob May 27 '17 at 18:09
  • It is probably a bit early to flag this as unclear, but we will only be able to answer the question properly with more information. Ideally in form of an MWE. – moewe May 28 '17 at 7:58
1

Your problems are not caused by tikz package but properties of scrbook regarding use of \MakeUppercase in definition of section style. For details see Stefan Kottwitz answer. Based on it, see if instead your definition of \titleformat{\section} the following

\titleformat{\section}
    {\sffamily\bfseries\fontsize{13}{11}\selectfont\uppercase}% <-- observe difference
    {\sffamily\thesection}
    {0.2em}
    {}

gives what you expect:

enter image description here

Wit above definition I can compile your document without error (of course, I wrote chapters, section and subsection titles directly in document).

Off-topic: I must confess that I'm lost in your document. Do you realy need all those redefinition? By the way, your defining of font size with for example \fontsize{14}{11} is wrong. The firs number is font size, the second is baseline skip (which had to be bigger than font size) also is missing \selectfont. Why you not use simpler small, or \large, or \Large commands?

| improve this answer | |
  • I am extremely thankful to you. My institute is new, we are making our own template of thesis, hence we are encountering lot of bugs. – Ranveer Singh May 28 '17 at 17:14
  • @RanveerSingh, you are welcome. Happy TeXing – Zarko May 28 '17 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.