Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\documentclass[openany, 10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[MeX]{polski}
\usepackage{titleps}
\usepackage[Lenny]{fncychap}

%\usepackage{tocloft}
\makeatletter
    \renewcommand\@seccntformat[1]{\csname the#1\endcsname.\quad}
    \renewcommand\contentsname{Spis}
    \renewcommand\numberline[1]{#1.\hskip0.7em}
    %\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\makeatother

\newcommand\MyTitle{\scshape Pacjent i Analityk}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LE,RO]{\normalsize\thepage}
\fancyhead[RE]{\scriptsize \textsc{\leftmark}}
\fancyhead[LO]{\scriptsize \textsc{\MyTitle}}
\fancyfoot[L,C,R]{}


 \frenchspacing

 %style form chapter
      %http://zoonek.free.fr/LaTeX/LaTeX_samples_chapter/0.html
 \usepackage{pstcol}
 \makeatletter
     \def\LigneVerticale{\vrule height 5cm depth 2cm\hspace{0.1cm}\relax}
     \def\LignesVerticales{
     \let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV}
     \def\GrosCarreAvecUnChiffre#1{%
     \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
     \rlap{\hbox to 1cm{\hss\mbox{\white #1}\hss}}%
     \vrule height 0pt width 1cm depth 0pt}

     \def\@makechapterhead#1{\hbox{%
     \huge 
     \LignesVerticales
     \hspace{-0.5cm}%
     \GrosCarreAvecUnChiffre{\thechapter}
     \hspace{0.2cm}\hbox{#1}%
     \renewcommand\numberline[1]{#1.\hskip0.7em}
   }\par\vskip 2cm}

   \def\@makeschapterhead#1{\hbox{%
   \huge 
   \LignesVerticales
   %\hspace{0.5cm}%
   \hbox{#1}%
   }\par\vskip 2cm}

   \newcommand\MySquare{% thanks to Gonzalo Medina
     %http://tex.stackexchange.com/users/3954/gonzalo-medina
   \leavevmode\hbox to 1.2ex{\hss\vrule height .9ex width .7ex depth -.2ex\hss}}
   \renewcommand\labelitemi{\MySquare}

   \usepackage{titletoc}

   \title{Foo is getting older}
   \author{Joseph Bar}
   \date{}

   \begin{document}
   \maketitle



   \frontmatter
       \tableofcontents
\chapter*{Chapter whitout a number}
\addcontentsline{toc}{chapter}{Chapter without a number}

\mainmatter
    \chapter{Solution}\label{chap:one}
    \section{One}
    \section{Two}
    \section{Another section}
    \chapter{Second solution}
    \chapter{Third chapter}
    \chapter*{Chapter without a number}
    \section{One}
    \section{Two}
\end{document}

The goal is:

  1. Put the dots next to chapter a) in ToC, b) in text

  2. Get left marking work correct, meaning - I want a name of chapter, number of a chapter [with dot], but without a word:"Chapter"

  3. Add dots from chapter to the page number in ToC,

  4. Enumerate style change: from native to dark square with bold number inside

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Below there's a possible solution: the tocloft package was used for 1)a) and 3). A redefinition of \chaptermark solved 2). A redefinition of \labelenumi using \fbox solved 4). Adding a dot after \thechapter in the already existing definition of \@makechapterhead solved 1)b). The code contains some comments showing where the changes were made:

\documentclass[openany, 10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[MeX]{polski}
\usepackage{titleps}
\usepackage[Lenny]{fncychap}
\usepackage{lipsum}

\usepackage{tocloft}
\renewcommand\cftchapaftersnum{.}% adds dot after chapter title in ToC
\renewcommand\cftchapdotsep{\cftdotsep}% adds leader dots from chapter titles to page numbers

\makeatletter
    \renewcommand\@seccntformat[1]{\csname the#1\endcsname.\quad}
    \renewcommand\contentsname{Spis}
    \renewcommand\numberline[1]{#1.\hskip0.7em}
\makeatother

\newcommand\MyTitle{\scshape Pacjent i Analityk}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LE,RO]{\normalsize\thepage}
\fancyhead[RE]{\scriptsize \textsc{\leftmark}}
\fancyhead[LO]{\scriptsize \textsc{\MyTitle}}
\fancyfoot[L,C,R]{}
\renewcommand\chaptermark[1]{%
  \markboth{\MakeUppercase{\thechapter.\ #1}}{}} % chapter mark wothout "Chapter"


 \frenchspacing

 %style form chapter
      %http://zoonek.free.fr/LaTeX/LaTeX_samples_chapter/0.html
 \usepackage{pstcol}
 \makeatletter
     \def\LigneVerticale{\vrule height 5cm depth 2cm\hspace{0.1cm}\relax}
     \def\LignesVerticales{
     \let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV}
     \def\GrosCarreAvecUnChiffre#1{%
     \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
     \rlap{\hbox to 1cm{\hss\mbox{\white #1}\hss}}%
     \vrule height 0pt width 1cm depth 0pt}

     \def\@makechapterhead#1{\hbox{%
     \huge 
     \LignesVerticales
     \hspace{-0.5cm}%
     \GrosCarreAvecUnChiffre{\thechapter.}% the final dot adds a dor after the chapter number in the document
     \hspace{0.2cm}\hbox{#1}%
     \renewcommand\numberline[1]{#1.\hskip0.7em}
   }\par\vskip 2cm}

   \def\@makeschapterhead#1{\hbox{%
   \huge 
   \LignesVerticales
   %\hspace{0.5cm}%
   \hbox{#1}%
   }\par\vskip 2cm}

   \newcommand\MySquare{% thanks to Gonzalo Medina
     %http://tex.stackexchange.com/users/3954/gonzalo-medina
   \leavevmode\hbox to 1.2ex{\hss\vrule height .9ex width .7ex depth -.2ex\hss}}
   \renewcommand\labelitemi{\MySquare}

   \title{Foo is getting older}
   \author{Joseph Bar}
   \date{}

\begin{document}
\maketitle

\frontmatter
\tableofcontents

\chapter*{Chapter whitout a number}
\addcontentsline{toc}{chapter}{Chapter whitout a number}

\renewcommand\labelenumi{%
  {\setlength\fboxsep{2pt}\fbox{\bfseries\arabic{enumi}}}} %redefinition for first level labels of enumerate

\mainmatter
\chapter{Solution}\label{chap:one}
\begin{enumerate}
\item First item.
\item Second item.
\item Third item.
\end{enumerate}
\lipsum[1-20]
\section{One}
\section{Two}
\section{Another section}
\chapter{Second solution}
\chapter{Third chapter}
\chapter*{Chapter whitout a number}
\section{One}
\section{Two}

\end{document}

Some images of the resulting document showing the changes requested:

The ToC (dot after chapter number and leaders from the title to the page number):

enter image description here

A typical numbered chapter tile showing the requested ending dot; this image also shows the required formatting for the labels of the first level of an enumerate environment:

enter image description here

A typical even-numbered header showing the desired formatting (number-dot-title):

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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