6

Here I queried how to identify the counters for \subsection and \theorem.

The resulting look would be the same (except for the math-specific things, like the content inside a theorem is put in emphasis) if only there is a way to prevent linebreaks after \subsection.

Is there a way to do this? Thanks.

Community
  • 1
  • 1

2 Answers2

11

One way is by using the titlesec package to format the section with 'runin'. Once you've installed the titlesec package for use you can put this in the preamble:

\usepackage{titlesec}

\titleformat{\subsection}[runin]
{\normalfont\large\bfseries}{\thesubsection}{1em}{}

The formatting settings above other than the 'runin' option are the default settings for subsections. Those can of course be modified, e.g., you could take out the '\large' if you wanted the subsection headings to be same size as the theorem headings.

Herbert Sitz
  • 21,858
  • 9
  • 50
  • 54
  • Perfect! Thanks. What does the 1em do? –  Jul 09 '10 at 23:19
  • 1em is in the 'sep' slot, which controls how much space is between the numbering and the section heading text. 1em is equal to the width of 1 times the width of a capital 'M' in font you're using. – Herbert Sitz Jul 10 '10 at 01:25
8

Darnit, Herb beat as I was typing...

FWIW, the full options to titleformat are:

\titleformat{command}[shape]{format}{label}{sep}{before}[after]

This was a question on SO about a year ago:

https://stackoverflow.com/questions/1469096/no-newline-after-subsection

Community
  • 1
  • 1
Richard Herron
  • 9,760
  • 12
  • 69
  • 116