# Roman numerals appear in toc but not in document

I'm writing a thesis and sections are required to have roman numerals in both the toc and the document itself. The pertinent document code looks like this:

\documentclass[twoside,12pt]{report}
%%%%%%%%%%%%%%%%%%%Preamble%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%PACKAGES TO USE IN THE DOCUMENT:
\usepackage[indentfirst]{titlesec} %To allow for formatting section titles
\usepackage{ragged2e} %To allow for indentation with the raggedright command

%%%%%%%SET SECTION HEADING FORMATTING
\titleformat*{\section}{\Centering\normalsize\bfseries\uppercase}{\renewcommand\thesection{\Roman{section}.}
\titleformat*{\subsection}{\RaggedRight\normalsize\bfseries\uppercase}
\titleformat*{\subsubsection}{\RaggedRight\normalsize\bfseries}
\renewcommand\thesection{\Roman{section}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\SweaveOpts{concordance=TRUE}
\section{First Section}
\section{Second Section}
\subsection*{First Subsection}
\end{document}


This code gives me titles formatted according to my specifications, but the \renewcommand\thesection{\Roman{section}.} code only seems to affect the toc, not the actual section titles. As you can see, I have the command both on its own and with the \titleformat command, but neither one produces results. How can I get the number to show up in the actual section title?

-

According to the manual of titlesec the command \titleformat* takes two arguments the section type/level and the format of the section. For the label you have to use \titleformat{command}[shape]{format}{label}{sep}{before code}[after code].

So you have to use something like the following

\renewcommand{\thesection}{\Roman{section}}
\titleformat{\section}
{\Centering\normalsize\bfseries\uppercase}
{\thesection. }
{12pt}
{}


to achieve the desired outcome.

-