It's not convenient to include the counter in the second argument of \titleformat
; this will cause starred sections to be numbered in an "unorthodox" way, as the following simple example shows:
\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}[block]{\large\scshape\centering{\Roman{section}.}}{}{1em}{}
\begin{document}
\section{Test Section}
\subsection{Test Subsection}
\section*{Test Section}
\subsection{Test Subsection}
\end{document}
This produces the following wrong result (the numbering is wrong, the spacing between the number and the title is wrong and the counter for subordinate sectional units isn't reset appropriately):
The right way to proceed here is to redefine \thesection
previously to use Roman numerals, as the following example illustrates:
\documentclass{article}
\usepackage{titlesec}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{test,
author= "The Author",
journal = "The Journal",
pages= "1-2",
year="2012"
}
\end{filecontents*}
\renewcommand\thesection{\Roman{section}}
\titleformat{\section}[block]
{\large\scshape\filcenter}{\thesection.}{1em}{}
\begin{document}
\section{test}
\cite{test}
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}
If you want to number the bibliography section, you can use the etoolbox
package to patch the \thebibliography
command to use \section
instead of the default \section*
:
\documentclass{article}
\usepackage{titlesec}
\usepackage{etoolbox}
\usepackage{filecontents}
\patchcmd{\thebibliography}{\section*}{\section}{}{}
\begin{filecontents*}{\jobname.bib}
@article{test,
author= "The Author",
journal = "The Journal",
pages= "1-2",
year="2012"
}
\end{filecontents*}
\renewcommand\thesection{\Roman{section}}
\titleformat{\section}[block]
{\large\scshape\filcenter}{\thesection.}{1em}{}
\begin{document}
\section{test}
\cite{test}
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}
Not related to the original problem but \centering
doesn't have arguments, so instead of \centering{text}
one should use something like {\centering text\par}
(the braces are only required if it is necessary to explicitly group to keep the effect local).