Here's a solution using the titlesec package; this will work as expected with both numbered and unnumbered chapters; taking into account the comments, I've replaced the initial definition of the circle with \CIRCLE
from the wasysym
package:
\documentclass[chapterprefix=true]{scrbook}
\usepackage{titlesec}
\usepackage{wasysym}
\titleformat{\chapter}[block]
{\normalfont\huge\sffamily\bfseries}
{\CIRCLE\vskip6pt\titlerule[1pt]\vskip9pt\chaptertitlename~\thechapter.}
{0.5em}{}
\titleformat{name=\chapter,numberless}[block]
{\normalfont\huge\sffamily\bfseries}
{\CIRCLE\vskip6pt\titlerule[1pt]\vskip9pt}
{0pc}{}
\begin{document}
\tableofcontents
\chapter{Test Numbered Chapter}
\chapter*{Test Unnumbered Chapter}
\end{document}
Some images of the output showing a numbered and an unnumbered chapter:
Starred chapters (and sections) don't get a number, nor a toc entry, nor a header. Problem is, the header is not cleared automatically. You have to do that manually using \markboth{}{}
. But from your example i can see that you want a toc entry and i think also a header. You could implement that.
A KOMA class provides the same command in a much more advanced way. Please read How to use unnumbered chapters with KOMA-script? to find out more. As of now, you can use the commands like described in the KOMA-script documentation. Changing over to KOMA should not make any difficulties concerning the commands just defined.
To sum it up, \addchap
makes an annumbered chapter, using its argument for the toc-entry and the header. If an optional argument is given, it is used for toc and head. If the starred form is used, no toc entry will be set and the header will be cleared from any former contents.
As this seems to be needed pretty often, i put the former code into a small package called unnumberedtotoc
(<- Downloadlink) which is compatible to KOMA and eases switching later on. This is an alpha version and there might never be any bug-fixes. If you want bullet-proof funtionality, use a KOMA-class.
The package provides just one option; indentunnumbered
. This is based on package tocbasic
(from the KOMA bundle).
\documentclass{book}
\usepackage{blindtext}
\usepackage[
% indentunnumbered
]{unnumberedtotoc} %get it from https://github.com/johannesbottcher/unnumberedtotoc
\begin{document}
\tableofcontents
\addchap{unnumbered chapter with toc and head}
\blindtext[10]
\addchap[title for toc and head]{chapter title}
\blindtext[10]
\addsec*{starred addsec}
\blindtext[10]
\addsec{regular addsec}
\blindtext[10]
\addsec*{starred addsec}
\blindtext[10]
\chapter{usual chapter}
\blindtext[10]
\chapter*{look at the header}
\blindtext[10]
\addchap*{really nothing, header cleared}
\blindtext[10]
\end{document}
The former example
\documentclass[a4paper,11pt,fleqn]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french,german,english]{babel}
\usepackage{lipsum}
\usepackage{microtype}
\usepackage{fancyhdr}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead[OR]{\bfseries \nouppercase{\rightmark}}
\fancyhead[EL]{\bfseries \nouppercase{\leftmark}}
\fancyfoot[EL,OR]{\thepage}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[EL,OR]{\thepage}
}
\fancypagestyle{addpagenumbersforpdfimports}{
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot{}
\fancyfoot[RO,LE]{\thepage}
}
%Implementing *some* KOMA functionality now
\usepackage{xparse}
\ProvideDocumentCommand{\addchap}{ s o m }{%
\typeout{providing a minimal version of addchapp.
You might want to use a KOMA class for full
features
}%
\chapter*{#3}%
\IfBooleanTF{#1}{
\markboth{}{}
}{
\IfNoValueTF{#2}{
\addcontentsline{toc}{chapter}{#3}
\markboth{#3}{#3}%
}{%
\addcontentsline{toc}{chapter}{#2}
\markboth{#2}{#2}%
}
}
}
\ProvideDocumentCommand{\addsec}{ s o m }{%
\typeout{providing a minimal version of addsec.
You might want to use a KOMA class for full
features
}%
\section*{#2}%
\IfBooleanTF{#1}{}{
\IfNoValueTF{#2}{
\addcontentsline{toc}{section}{#3}
\markright{#3}%
}{%
\addcontentsline{toc}{section}{#2}
\markright{#2}%
}
}
}
%A KOMA class also provides this feature
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother \clearpage{\pagestyle{plain}\cleardoublepage}
\begin{document}
\frontmatter
\cleardoublepage
\tableofcontents
%\setlength{\parskip}{0em}
%\setlength{\parindent}{4ex}
\mainmatter
\addchap{Introduction}
\lipsum[3-30]
\addchap[toc and head]{Donald is a great duck}
\lipsum[3-30]
\addsec{Daisy}
\lipsum[3-30]
\addsec{Dagobert}
\lipsum[3-30]
\chapter{State of the Art}
\lipsum[7-20]
\addchap*{really nothing, header cleared}
\end{document}
Best Answer
I can do it "manually" with the other nomenclature package: "nomentbl". You have to configure the tex compiler. I used Texstudio so I add an user command in:
Options > Configure Texstudio > Build > User commands then put these command in
makeindex -s nomentbl.ist -o %.nls %.nlo Normally, you have to do the following procedure to have nomenclature:
Compile > Make index > Recompile
The principle is the same: when you run a make index, Latex will generate an .nls file. Next time you compile, the nomenclature will appear.
So instead of run a second compile, all you need is create a file name nomen_chap0x then you copy the content in the .nls file into the nomen_chap0x then you put the command : \input{nomen_chap0x}. When you compile, the nomenclature will appear in the section.
The important thing is you have to delete the .nls file and comment all of nomenclature in the chapter to avoid the same nomenclature's appearance in the next chapter.
In the second chapter, you have to create another nomenclature, used only for this chapter, and you repeat the procedure above
Her an mwe for what I'm talking about:
Here is the results:
I also put the entire mwe folder fmi: enter link description here