Period in TOC but not in reference

The easiest way is to change the class. scrbook from the KOMA-bundle has an "autodot" feature which adds the period only at the appropriate places:

\documentclass{scrbook}
\renewcommand{\thesection}{\Roman{section}}

\begin{document}
 \tableofcontents
 \section{First section\label{l}}
 This is Section \ref{l}.
\end{document}

enter image description here


You can use titlesec and titletoc. But then a dot is added to the numbers of all section levels.

\documentclass{book}
\renewcommand{\thesection}{\Roman{section}}
\usepackage{titlesec}
\titlelabel{\thetitle.\enskip}
\usepackage[dotinlabels]{titletoc}
\begin{document}
\tableofcontents
\section{First section\label{l}}
Section \ref{l} contains new definitions.
\end{document}

enter image description here


Here is an additional KOMA-Script suggestion that adds the dot only to the section level:

\documentclass[
  numbers=noenddot
  ]
  {scrbook}
\addtokomafont{disposition}{\rmfamily}
\renewcommand{\thesection}{\Roman{section}}

\usepackage{xpatch}
\xpatchcmd{\sectionformat}{\autodot}{.}{}{\PatchFailed}
\newcommand\sectionentrynumberformat[1]{\renewcommand\autodot{.}#1}
\RedeclareSectionCommand[
  tocentrynumberformat=\sectionentrynumberformat
]{section}

\usepackage{blindtext}
\begin{document}
 \tableofcontents
 \section{First section\label{l}}
 Section \ref{l} contains new definitions.
%
\blinddocument
\end{document}

enter image description here

enter image description here


Here's a solution that works with the book document class. It (a) uses the tocloft package and (b) resets the low-level LaTeX macro \@seccntformat for section-level entries.

\documentclass{book}

\renewcommand{\thesection}{\Roman{section}}
\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname\quad}%     default
   {\csname #1@cntformat\endcsname}}%  enable individual control
\newcommand\section@cntformat{\thesection.\quad} % for section-level entries
\makeatother
\usepackage[titles]{tocloft}
\renewcommand{\cftsecaftersnum}{.} % place "." after section-level "number"

\begin{document}
\tableofcontents
\section{First section\label{l}}
This is Section \ref{l}.
\end{document}