3
\documentclass[a4paper,12pt]{article}
%twoside yaz iki taraflı için
\usepackage[top=2.5 cm, bottom=2.5 cm, left=4 cm, right=2.5 cm]{geometry}

\usepackage[turkish,shorthands=:!]{babel}
\usepackage{fontspec}
\usepackage{titlesec}

\setmainfont{Times New Roman}
\setsansfont{Times New Roman}
\titlelabel{\thetitle.\quad}
\titleformat{\section}
  {\normalfont\fontsize{12}{15}\bfseries}
  {\thesection}
  {1em}
  {}
\begin{document}
\section{sec1}
test      
\subsection{subsec2}
test
\end{document}

There must be a dot after section number with \titlelabel{\thetitle.\quad} but not. What's the problem?

  • 1
    Why not use just \titleformat{\section} {\normalfont\fontsize{12}{15}\bfseries} {\thesection.\quad} {1em} {}? – Phelype Oleinik Jul 5 '18 at 18:02
  • I tried but didn't work. – ömer koçhan Jul 5 '18 at 18:13
  • 1
    You want it like this: i.stack.imgur.com/ZoEYX.png ? I just added .\quad after \thesection... – Phelype Oleinik Jul 5 '18 at 18:15
  • It work but there is unnecessary space between number and section and in ToC there isn't any section dot. – ömer koçhan Jul 5 '18 at 18:20
4

I think you want it like this:

enter image description here

The unnecessary space you said in the comments is because the fourth mandatory argument to \titleformat is the spacing, which you already had set to 1em, so adding a \quad doubled it.

To add the dot after the number in the ToC you can redefine \numberline:

\let\LTXnumberline\numberline
\def\numberline#1{\LTXnumberline{#1.}}

this is a low level trick that works with the standard classes. But it will probably not work if you use another class or some ToC styling package.

\documentclass[a4paper,12pt]{article}
%twoside yaz iki taraflı için
\usepackage[top=2.5 cm, bottom=2.5 cm, left=4 cm, right=2.5 cm]{geometry}

\usepackage[turkish,shorthands=:!]{babel}
\usepackage{fontspec}
\usepackage{titlesec}

\setmainfont{Times New Roman}
\setsansfont{Times New Roman}
\let\LTXnumberline\numberline
\def\numberline#1{\LTXnumberline{#1.}}
\titlelabel{\thetitle.\quad}
\titleformat{\section}
  {\normalfont\fontsize{12}{15}\bfseries}
  {\thesection.}
  {1em}% this gives a \quad of space
  {}
\begin{document}
\tableofcontents
\section{sec1}
test      
\subsection{subsec2}
test
\end{document}
| improve this answer | |

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.