GeneralHow do I suppress newline after a subsection heading?

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How do I suppress newline after a subsection heading?

Post by frabjous »

I don't understand what's going on. Why would you have section headings inside of quotations? That doesn't make any sense. Are you just trying to achieve a certain look? Or a new kind of numbered environment? Are these really quotations, not subsections at all, and you just want them to have numbers so you can refer back to them? Are these going in a table of contents? Please describe what it is you're trying to achieve semantically; it's hard to know what the best kind of thing to do would be otherwise.

By the way, {\bf whatever} is obsolete syntax. Use \textbf{whatever} whenever possible, or else {\bfseries whatever}.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

quickq
Posts: 17
Joined: Wed Oct 13, 2010 8:14 pm

How do I suppress newline after a subsection heading?

Post by quickq »

You're absolutely right. It is, semantically speaking, not a quotation. Instead, it is a visual grouping of subsections that go together very very strongly (specifically, they are a part of a proof, but the proof is not expressed symbolically but in paragraph form.

I currently have

Code: Select all

\titleformat{\subsection}[runin]% runin puts it in the same paragraph
       {\normalfont\bfseries}% formatting commands to apply to the whole heading
       {\thesubsection.}% the label and number
       {0.5em}% space between label/number and subsection title
       {}% formatting commands applied just to subsection title
       [.]% punctuation or other commands following subsection title

\titlespacing*{\subsection}{0pt}{0pt}{0.5em}
based on everything you suggested earlier. However, to get the tightly-grouped effect, in one part of my code I have:
\begin{center}
\begin{minipage}[]{0.85\linewidth}
\subsection{keyword1}
text text text
\subsection{keyword2}
text text text
[...]
\end{minipage}
\end{center}
It looks exactly like I would like it to look, I have no problems with that. In fact, I am so happy with how this part looks, I want (nearly) every subsubsection in the whole paper to look the same way as well! So far, I just copied the code above into the preamble, changing subsection to subsubsection:

Code: Select all

\titleformat{\subsection}[runin]% runin puts it in the same paragraph
       {\normalfont\bfseries}% formatting commands to apply to the whole heading
       {\thesubsection.}% the label and number
       {0.5em}% space between label/number and subsection title
       {}% formatting commands applied just to subsection title
       [.]% punctuation or other commands following subsection title

\titlespacing*{\subsection}{0pt}{0pt}{0.5em}
now I would like the very same effect (any subsubsection to be between
\begin{center}
\begin{minipage}[]{0.85\linewidth}
and
\end{minipage}
\end{center}
at this point, since it looks exactly like I want when I use it, I am just putting the minipage code in manually.

Note that there is one complicating factor: although the subsubsections are usually tightly bound with each other, so that I like the minipage effect, there is one part where I like the original meaning of subsubsection, before I added the redefinitions I listed (where I said I replaced subsection with subsubsection). Is there a way to return subsubsection to its normal meaning for just one part of the text?

(A part of the text that is actually not tightly linked prose the way almost all of the text is).

thank you.
Post Reply