I'm writing a prospectus and my college has given me the following class for formatting it. I'm new to Latex and I've seen the these examples already (one, two, and three) but I can't understand how to apply them to the class I have. Here is (I believe) the relevant pieces of the class.

% -- Section Headings --  modified revtex4.sty

{section}%                          % the name
{1}%                                % the level
{\z@}%  %\z@ = 0pt.                 % the indent
{.8cm \@plus1ex \@minus .2ex}%      % the beforeskip
{.25cm}%                            % the afterskip
{\normalfont\large\sffamily\bfseries}}%      % the style

{.8cm \@plus1ex \@minus .2ex}%

{.5cm \@plus1ex \@minus .2ex}%

With the class as currently show when I enter:

Section \ref{example} is my example section.

I get something like:


Section I. is my example section.

I'm trying to remove the trailing period in the text but not in the section heading itself. If anyone can help me fix this I'd be grateful!

  • The trailing period is introduced right at the beginning with \renewcommand{\thesection}{\Roman{section}.} If you alter that definition, it will go, although it will remove the period in the headings as well, so you will have to make other changes to put it back. Imvho those changes at the start weren't the best approach. It's a little bit difficult to completely answer this question, I think, without knowing precisely what you want. – Au101 Jul 27 '15 at 23:50
  • Welcome! Code fragments are of limited usefulness. A complete example and, if necessary, a link to the class would be helpful. The code posted can be adapted to remove the dot. But I don't think it can be adapted to include it in the title of the section. We need another bit for that. – cfr Jul 27 '15 at 23:50

The ending-period stems from the fact that you're including it in the counter representations


since \thesection (and friends) are used as-is for writing the references when using \label. Instead, you should change \@seccntformat for adding an ending-period in all sectional headings:

\renewcommand\@seccntformat[1]{\csname the#1\endcsname.\quad}

The above definitions of \the... still seems strange as they are not hierarchical. Typically \thesubsubsection would include a reference to \thesubsection, and similarly \thesubsection would include a reference to \thesection. My suggestion would therefore be to use


However, the choice is eventually yours.

| improve this answer | |
  • This solution worked for me, however this was inside a .cls file so I left off the \makeatletter and \makeatother commands. I also had to remove the period after all the counter representations. As for prepending the section onto the subsection, etc. That would be against the department's style guide for this particular doc unfortunately since that would be clearer. – Josh Coburn Jul 28 '15 at 17:52

It is quite easy to do with titlesec:


\titleformat{\section}{\normalfont\large\sffamily\bfseries}%global formatting (label %and title}%
{\thesection.}%label formatting
{0.5em}% separation between label and title
{}%commands to be  applied to the title
[]% optional argument after title

\titlespacing{0pt}{.8cm \plus1ex \minus .2ex}{0.25cm}
| improve this answer | |
  • I think that, in the question, revtex4.sty should probably be revtex4.cls since the former appears to have the disadvantage of not existing. If so, won't this fail with compilation errors? I tried it with the unmodified revtex4 class and got complaints about inaccessible things immediately. Admittedly, without the actual class file, it is impossible to know it won't work since they might have modified it to be titlesec-friendly, but on the balance of probabilities.... – cfr Jul 28 '15 at 1:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.