2

I have two problems in one. I am writing my thesis using the package fancyhdr, and all my chapters look great. However I have to add some parts, which are not chapter but I would like to have the title as one.

The problem is my results do not look like as I expected.

All chapters look like:

enter image description here

So my idea is that no-chapter parts should look like:

enter image description here

But in real they look like:

enter image description here

and it gets worse, because my Contents looks awful.

enter image description here

I am using this preamble for the style of my heading.

\fancyhead{} \fancyhead[]{}

\fancyhead[RE]{\scriptsize\leftmark}

\fancyhead[LO]{\scriptsize\rightmark}\fancyhead[LE,RO]{\thepage}

\fancyfoot[]{}


And in the none-Chapter part I wrote


\renewcommand{\chaptername}{}

%\renewcommand\chaptername{\fontsize{50}{50}\selectfont\Large{Curriculum Vitae}}

\renewcommand\thechapter{\fontsize{30}{30}\selectfont\Huge{Curriculum Vitae}}

I was trying too many solutions posted here, but none of those work for me. If I use \chaptername instead of \thecapter (which I know is the chapter number), the nice rectangle frame becomes into a line. if I use just \chapter no eve a line is generate and it is equivalent if I use \chapter*{}. I know the problem in the contents is because the \fontsize and the \selectfont, but those are the size which give me a properly size in the title.

Does anybody knows what to do? I would really appreciate any help. If you need to know my preamble it is here

Regards,

Flavia

  • You seem to use the fncychap package that you don't mention. If that's the case, you could take the style used for numbered chapters as a basis and make an own style for unnumbered chapters. Alternatively, modify your re-definition of \thechapter as follows : \renewcommand\thechapter{{\fontsize{30}{30}\selectfont\Huge{Curriculum Vitae}}\vphantom{0}}, but I'm not sure there won't be unpredictable effects. – Bernard Mar 12 '14 at 21:56
  • Please post a complete Minimal Working Example and not just fragments of code which leave people guessing what is used or what is relevant. This should be code which people can compile to reproduce the issue - not just the preamble - and it should contain only what is necessary to reproduce that issue - not the entire preamble. – cfr Mar 13 '14 at 0:04
1

You are using the Lenny chapter style from fncychap (this style is, in my opinion, a little ugly and perhaps you should reconsider using it). Redefining \thechapter to produce a title and its formatting is not the thing to do; \thechapter is only for the representation of the chapter counter; misusing it as you did in your example code will produce the undesired results you already experienced.

With the help of titlesec and TikZ I defined a command \specialchapter to produce a style for chapter headings like the one you want; the special chapter is produced using \chapter* and the ToC entry is added used \addcontentsline:

\documentclass{book}
\usepackage[Lenny]{fncychap}
\usepackage[explicit]{titlesec}
\usepackage{tikzpagenodes}

\newcommand\specialchapter{%
\titleformat{\chapter}[display]
  {\normalfont\usefont{OT1}{phv}{m}{n}\selectfont}
  {}
  {0pt}
  {\begin{tikzpicture}[remember picture]
    \node[inner ysep=0pt] (title)
      {\hspace*{15pt}\Huge\rmfamily##1\hspace*{15pt}};
    \draw[overlay] 
      ([xshift=10pt]title.south west) -- 
      (current page text area.west|-title.south west) --
      ++(0pt,40pt) --
      ++(\textwidth,0pt) --
      (current page text area.east|-title.south east) --
      ([xshift=-10pt]title.south east);
   \end{tikzpicture}% 
  }
}
\begin{document}

\tableofcontents
\chapter{Discussion and Perspectives}
{
\specialchapter
\chapter*{Curriculum Vitae}
\addcontentsline{toc}{chapter}{Curriculum Vitae}
}
\chapter{Another regular chapter}

\end{document}

An image of the ToC:

enter image description here

A regular chapter:

enter image description here

The special chapter:

enter image description here

The next regular chapter:

enter image description here

|improve this answer|||||
  • 1
    @cfr Ah, yes. I'll fox it. Thanks for noticing! – Gonzalo Medina Mar 13 '14 at 0:02
  • 3
    Now I'm really intrigued... I'm certainly glad I'm not a chicken! – cfr Mar 13 '14 at 0:05
  • 3
    @cfr LOL! Sorry for the typo :) In the meantime, I "foxed" the code. – Gonzalo Medina Mar 13 '14 at 0:06
  • Yes you are right, I use fancycahp, sorry about the package. Thanks for the code, I were never think something like that, however it works partially. I mean it solve the first problem I posted, but now other parts of my thesis are damaged. I am using \appendix an before the code they were looking with the [Lenny] style, but now they are treated as \specialchapter and look terrible. – Flavia Mar 13 '14 at 12:28
  • @Flavia You need to keep the effect of \specialchapter local (the extra pair of braces in my example code). In your file CV.tex you then need: { \specialchapter \chapter*{Curriculum Vitae} \addcontentsline{toc}{chapter}{Curriculum Vitae} } And the content of the chapter goes here... (again, notice the braces before \specialchapter and after the \addcontententsline command). – Gonzalo Medina Mar 13 '14 at 12:29

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.