0

Dear last time a received message really quickly. I checked some of solution found here and in the internet, but those don't working for me. I'm placing MWE

\documentclass[12pt,a4paper,twoside]{report}
\usepackage[top=25mm, bottom=25mm, outer=15mm, inner=35mm]{geometry}

\renewcommand{\baselinestretch}{1.15}

\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{polski}
\usepackage[polish]{babel}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{fancyhdr}

\titleformat
{\part} 
[display]
{\bfseries \huge \itshape\centering} 
{Część \ \thepart} 
{0.5ex} 
{
    \rule{\textwidth}{0pt}
    \vspace{1ex}
    \centering
} 
[
\vspace{-0.5ex}
\rule{\textwidth}{0pt}
] 

\titleformat{\chapter}[hang]
{\normalfont\huge\bfseries}
{\thechapter}{18pt}{\huge}
\titlespacing*{\chapter}{0pt}{50pt}{20pt}

\pagestyle{fancy}
\fancyhf{}


\fancypagestyle{plain}{}
\pagenumbering{arabic}
\rfoot{Strona ~\thepage~} 
\renewcommand{\headrulewidth}{0pt}

\makeatletter
\renewcommand\@biblabel[1]{#1.}
\makeatother

\usepackage{etoolbox}
\makeatletter
\patchcmd\chapter
{\if@openright\cleardoublepage\else\clearpage\fi}
{\par}% Inserting a \par here!
{}{}
\makeatother

\begin{document}
    \tableofcontents
    \part{The Part name}
    ...
    \chapter{The First Chapter name}
    ...
    \chapter{The Second Chapter name}
    ...
    \chapter{The Third Chapter name}
    ...

\end{document}

I would like to have the dot after chapter number in table of contents and the content as well. Could someone help me in this matter?

2
  • Does adding \renewcommand{\thechapter}{\arabic{chapter}.} to the premble of your document result in the desired output?
    – leandriis
    Apr 9 '18 at 17:41
  • 2
    @leandriis: this will result in adding a dot to every reference to the chapter.
    – Bernard
    Apr 9 '18 at 18:35
1

Here is a solution with titlesec and its companion packages titleps and titletoc:

\documentclass[12pt, a4paper, twoside, openright]{report}
\usepackage[vmargin=25mm, outer=15mm, inner=35mm, showframe]{geometry}
\usepackage{setspace}
\setstretch{1.15}

\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{polski}
\usepackage[polish]{babel}
\usepackage[newparttoc, clearempty, explicit, newparttoc]{titlesec}
\usepackage{titletoc}
\usepackage{lipsum}

\titleformat
{\part}
[display]
{\bfseries \huge \itshape\filcenter}
{Część \ \thepart}
{3.5ex}
{#1 }

\titleformat{\chapter}[hang]
{\thispagestyle{empty}\normalfont\huge\bfseries}
{\thechapter.}{18pt}{\huge}
\titlespacing*{\chapter}{0pt}{50pt}{20pt}

\newpagestyle{myplain}{%
\sethead{}{}{}
\setfoot[~Strona ~\thepage][][]{}{}{Strona ~\thepage~}
}

\pagestyle{myplain}

    \titlecontents{chapter}
    [0em] %
    {\bigskip\bfseries\large}
    {\thecontentslabel.\enspace}%\thecontentslabel
    {}
    {\hfill\contentspage}[\smallskip]

\begin{document}

    \tableofcontents
    \part{The Part name}
    \lipsum[1-3]
    \chapter{The First Chapter name}
    \lipsum[4-12]
    \chapter{The Second Chapter name}
    \lipsum[13-24]
    \chapter{The Third Chapter name}
    \lipsum[25-30]

\end{document} 

enter image description here enter image description here

3
  • thank you for your answer. But your code changing my whole document. I fugured out after your answer what I have to change, but for those who don't know the better would be answer pointing what has to be changed. Thanks!
    – Emil Kob
    Apr 10 '18 at 16:21
  • @EmilKob: What has to be changed, except fancyhdr and titleps are not compatible, since they tackle the same parameters?
    – Bernard
    Apr 10 '18 at 16:32
  • I'm not a specialist in Tex settings. I even can't answer your questions. I know that Tex allows to set appearance as user wants but I'm regular user which will need sometimes help. Thank you for your post because it's enable me to solve my problem. Thanks!
    – Emil Kob
    Apr 11 '18 at 19:39
0

After the answer given by Bernard I would like to clarify what has to be done to make the changes described in my question. I add a comments at the side of things which has to be added.

\documentclass[12pt,a4paper,twoside]{report}
\usepackage[top=25mm, bottom=25mm, outer=15mm, inner=35mm]{geometry}

\renewcommand{\baselinestretch}{1.15}

\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{polski}
\usepackage[polish]{babel}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{fancyhdr}

\titleformat
{\part} 
[display]
{\bfseries \huge \itshape\centering} 
{Część \ \thepart} 
{0.5ex} 
{
    \rule{\textwidth}{0pt}
    \vspace{1ex}
    \centering
} 
[
\vspace{-0.5ex}
\rule{\textwidth}{0pt}
] 

\titleformat{\chapter}[hang]
{\normalfont\huge\bfseries}
{\thechapter.}{18pt}{\huge} %%--you had to add dot at the end of thechapter word
\titlespacing*{\chapter}{0pt}{50pt}{20pt}

\pagestyle{fancy}
\fancyhf{}


\fancypagestyle{plain}{}
\pagenumbering{arabic}
\rfoot{Strona ~\thepage~} 
\renewcommand{\headrulewidth}{0pt}

\makeatletter
\renewcommand\@biblabel[1]{#1.}
\makeatother

\usepackage{etoolbox}
\makeatletter
\patchcmd\chapter
{\if@openright\cleardoublepage\else\clearpage\fi}
{\par}
{}{}
\makeatother

%%--you have to put this phrase which formatting the table of content appearance
\titlecontents{chapter}
[0em] 
{\bigskip\bfseries\large}
{\thecontentslabel.\enspace}%\thecontentslabel
{}
{\hfill\contentspage}[\smallskip]


\begin{document}
    \tableofcontents
    \part{The Part name}
    ...
    \chapter{The First Chapter name}
    ...
    \chapter{The Second Chapter name}
    ...
    \chapter{The Third Chapter name}
    ...

\end{document}
3
  • I do not understand what the rules with 0pt thickness are for?
    – Bernard
    Apr 10 '18 at 19:17
  • Hi, me as well :)
    – Emil Kob
    Apr 11 '18 at 19:40
  • I've just found out I forgot to post the simplified code (without the rules with 0 thickness, which seemed to be there only for problems of vertical spacing). I've just updated.
    – Bernard
    Apr 11 '18 at 19:50

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.