Add a symbol before every section but not before every subsection

numberingsectioningtitles

(I'll use $+$ for the "symbol" in question).

What I want to achieve:

+1. Section

Lorem ipsum

1.1. Subsection

Lorem ipsum

That is,

  • Have every section name after a $+$ and the section number
  • Have every subsection name after the section number and the subsection number (no $+$ before the section number).

I'm using a report type document and I currently have a code that uses

\titleformat{\section}[hang]{\bfseries}{\LARGE\thesection}{1em}{\LARGE #1}
\renewcommand{\thesection}{$+ \,$\arabic{section}}
\titleformat{\subsubsection}[hang]{\bfseries}{\large\thesubsubsection}{1em}{\large #1}

which compiles documents of the form

+1. Section

Lorem ipsum

+1.1. Subsection

Lorem ipsum

Not the desired result.

How can I make my document look like the first example?

Best Answer

The following solution, which does not require loading any external packages, has the added advantage of not messing up the ability to create cross-references to section-level headers via the standard LaTeX \label-\ref approach. (A command such as \renewcommand{\thesection}{$+ \,$\arabic{section}} does affect how cross-references look -- probably not the intended outcome, though.) Instead, it relies on some code I learned about years ago, when I studied the book "The LaTeX Companion".

enter image description here

\documentclass{article} % or some other suitable document class

% See p. 21 of "The LaTeX Companion", 2nd ed.
\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}    % section level 
\newcommand\subsection@cntformat{\thesubsection.\quad} % subsection level 
\makeatother

\begin{document}
\section{Section} \label{sec:uno}
Lorem ipsum.
\subsection{Subsection}
A cross-reference to section \ref{sec:uno}.
\end{document}