# Changing the section title

\section{Introduction}


gives something like

# 1. Introduction

How can I rather obtain the following header?

# Section 1. Introduction

-
For example: \def\thesection{Section~\arabic{section}.} – Eddy_Em Feb 4 '13 at 7:19
Should this only affect the section title as it's set, and not the reference? What \documentclass are you using? – Werner Feb 4 '13 at 7:25
@Werner: I use the \documentclass{article}. There is no table of content, so it should only affect the section title. Thanks! I will try Eddy_Em' solution. – user7064 Feb 4 '13 at 7:40

Without using hyperref and within the default document classes, you could patch \@sect to conditionally insert Section~ based on whether you are in \section or not:

\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\@sect}% <cmd>
{\relax\@svsec}% <search>
{\relax\ifnum#2=1\relax Section~\fi\@svsec}% <replace>
{}{}% <success><failure>
\makeatother
\begin{document}
\section{A section}\label{section}
\subsection{A subsection}
See Section~\ref{section}.
\end{document}


The patch is provided by etoolbox's \patchcmd. It searches fo \relax\@svsec and inserts the condition inbetween. The condition checks if the level of the sectional unit matches "level 1" (that of \section), as is the case when looking at the definition in article.cls (the second argument to \@startsection):

\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}


For detail on the components of \@startsection, see Where can I find help files or documentation for commands like \@startsection for LaTeX?

-
I'm not quite sure that I follow what the purpose of \@svsec is. – Tyler Crompton Oct 21 at 20:32

You can use a very useful feature of TeX; a command called as

\csname foo\endcsname


will be silently ignored (actually \relax would be executed, which does nothing) if \foo isn't defined.

So doing

\documentclass{article}
\makeatletter
\makeatother
\newcommand{\namedsection}{Section }

\begin{document}
\section{A section}\label{section}
\subsection{A subsection}
See Section~\ref{section}.
\end{document}


you reach your aim.

If you also want to add "Subsection" in front of the subsection number, just add

\newcommand{\namedsubsection}{Subsection }


The macro \@seccntformat is described, with similar tricks, in the TeX FAQ, see Adjusting the presentation of section numbers

-
Thank you :-) @egreg – user7064 Feb 5 '13 at 7:19