4

I am using REVTex 4-1, for my own personal use, not a paper submission. I like using REVTex and I have gotten somewhat used to it, but for my current purposes I need left aligned subsections headings. In REVTex only rmp documentclass option gives that, but it also changes other aspects(I prefer prb).

I tried using command \titleformat from the titlesec package, but i can't figure out how to change only one option without changing other settings set by the REVTex (and prb)

\titleformat{\subsection}{\raggedright}{}{}{}

\titleformat*{\subsection}{\raggedright}

Is there a way to only set left alignment, without changing other settings?

1
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Jan 11, 2015 at 20:13

2 Answers 2

6

You can simply load the package etoolbox and patch the definitions of \section and \subsection to have \raggedright instead of \centering.

MWE:

\documentclass[prb]{revtex4-1}
\usepackage{etoolbox}
\patchcmd{\section}
  {\centering}
  {\raggedright}
  {}
  {}
\patchcmd{\subsection}
  {\centering}
  {\raggedright}
  {}
  {}


\begin{document}
\section{Long long long long long long long long long long long long long long long long long long long long long long long section title}

\subsection{Long long long long long long long long long long long long long long long long long long long long long long long subsection title}
\end{document} 

Output:

enter image description here

0

If you want to keep using the pra option in document class and make the title move to the left, try this:

\usepackage{titlesec}
% move section headings to left
\titleformat{\section}{\raggedright\bfseries}{\arabic{section}.}{1em}{}`
3
  • (a) \thesection instead of \arabic{section} keeps the kind of numbering. (b) The corresponding command form of environment flushleft for left aligned text is \raggedright. May 25, 2017 at 14:04
  • Thank you for the comment. I cannot comply to your suggestion about replacing \arabic{section} though. In revtex4-1 class roman numbering is set as default, and to dominate over this \arabic{section} seems to be the only possible way. Working with \thesection did not give the required result.
    – thatgeeman
    Jun 9, 2017 at 14:36
  • (a) I would not mix different numbering formats for the same entity. (b) If \thesection does not have the desired outcome, then it should be redefined. Jun 9, 2017 at 16:24

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.