tags:

views:

49

answers:

2

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.

+3  A: 

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
Perfect! Thanks. What does the 1em do?
George Scaria
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
+3  A: 

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:

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

richardh
@richard: Feels like I just won at Latex Bingo.
Herbert Sitz
Thanks for the link to the previous question.
George Scaria