GeneralModifying paragraph heading formatting

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
User avatar
avi9526
Posts: 6
Joined: Mon Mar 12, 2012 2:04 pm

Modifying paragraph heading formatting

Post by avi9526 »

Hi,
I need to get paragraph looks like simple text.
For now its look like:
"This is paragraph Blabla bla blablabla."
but I need:
"This is paragraph. Blabla bla blablabla."

I try to use titlesec package (I really bad understand what I do :) )

Code: Select all

\titleformat{\paragraph}[hang]{\normalfont\normalsize}{\theparagraph.}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1em}
but it's doesn't help.

How to solve this trouble? Thanks!
MS Word -> OpenOffice -> LibreOffice -> LaTeX

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Modifying paragraph heading formatting

Post by Stefan Kottwitz »

avi9526 wrote:Hi,

I try to use titlesec package (I really bad understand what I do :) )

Code: Select all

\titleformat{\paragraph}[hang]{\normalfont\normalsize}{\theparagraph.}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1em}
but it's doesn't help.
where did you get that from? The titlesec manual helps understanding what to do. The appendix supports an easy start, as it provides titlesec settings for the default layout of the standard classes. You could simply copy and change that as desired. For example:

Code: Select all

\documentclass{article}
\usepackage{titlesec}
\titleformat{\paragraph}[runin]{\normalfont\normalsize}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{\the\fontdimen2\font}
\begin{document}
\paragraph{This is a paragraph} with some text.
\end{document}
paragraph.png
paragraph.png (4.35 KiB) Viewed 11407 times
The differences to the standard headings are
  • no \bfseries
  • spacing after heading changed from 1em to \the\fontdimen2\font, which means an interword space.
Stefan
LaTeX.org admin
User avatar
avi9526
Posts: 6
Joined: Mon Mar 12, 2012 2:04 pm

Re: Modifying paragraph formatting

Post by avi9526 »

Wow.
But is there any way to get dot direct after paragraph title?
"This is a paragraph title. This is some text."

Thanks!
MS Word -> OpenOffice -> LibreOffice -> LaTeX
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Modifying paragraph heading formatting

Post by Stefan Kottwitz »

Yes, there's an optional argument of \titleformat for code which comes after the heading. You could write the dot there. Also the space after the run-in heading could be made there, so we remove the complicated \the\fontdimen2\font from \titlespacing.

Code: Select all

\titleformat{\paragraph}[runin]{\normalfont\normalsize}{\theparagraph}{1em}{}[. \mbox{}]
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0pt}
I added an empty box with \mbox to ensure that the space would be made.

Stefan
LaTeX.org admin
Post Reply