# Default paragraph headings with possible override

I am currently creating a new class for the reports that we do at work. All of our reports require that each paragraph have an in-line, non-numbered heading. Most of the time this heading is the same for all paragraphs in a given document. However, on occassion the heading does change. The way this is currently done is as follows:

\documentclass{article}
\begin{document}
\section{A Section}
\subsection{A SubSection}
(f) Para 1

(f) Para 2

(g) Para 3

(f) Para 4
\end{document}


In the above example, this document requires that most paragraphs begin with "f" but a few paragraphs begin with "g". What I would like to do is set up a preamble command that would set the default paragraph heading and then have a per paragraph command that would override this default, such as:

\documentclass{article}

\begin{document}
\section{A Section}
\subsection{A SubSection}
Para 1

Para 2

para 4
\end{document}


Using either method this should produce the a document like:

1 A Section

1.1 A SubSection

(f) Para 1

(f) Para 2

(g) Para 3

(f) Para 4

• Your question isn't very clear, what is the (1) heading for Paragraphs is it always 1 (at the start) or is it the subsection number or??? Normally paragraphs don't have headings and the next level of heading after subsection is subsubsection, are your headed paragraphs marked up as \subsubsection{1} or if not, how are they marked up? It always helps if you supply a complete test document. – David Carlisle Nov 27 '13 at 17:15
• You're asking for a very difficult feature. Paragraphs are used everywhere, for instance for typesetting a section title. Very deep surgery would be needed to automatically add something only in front of “text” paragraphs. – egreg Nov 27 '13 at 18:50

I guess you want something like the following:

\documentclass{article}
\usepackage{blindtext}
\paragraph{#1}}
{\bfseries\noindent (#1) }}
\vspace{\baselineskip}{\bfseries\noindent (#1)
\par\noindent}}

\begin{document}
\section{A Section}
\subsection{A SubSection}
\cleardoublepage
\cleardoublepage
\end{document}


The implementation could be much cleaner, but this should give you a starting point.

Have a look at article.cls to see the original definition of \paragraph{<text>}.

As @egreg mentioned in his comment, LaTeX uses paragraphs (\par)in various ways. Those are not always apparent to a casual user.

You could define a new environment, in which a blank line (or \par) is redefined. But then again, what happens if you have 2 paragraphs belonging to the same heading/item?

The aproach above has the advantage of semantic markup, the user/author is expecting something to happen when writing \headinga.

• Or are you looking for some kind of labeled list? – Johannes_B Nov 27 '13 at 18:02
• You are on the right track, but I don't want to force people to put \heading before all of the paragraphs. You could think of it as a labeled list with a default label that can be overridden. Again, in this case you would have to put \item before each paragraph though. – LWhitson2 Nov 27 '13 at 18:24
• Think about, where paragraphs are used. You (or the user) have to tell the system what is going on. Or you could define an environment, in which a paragraph has another meaning. Then again, input for one »item« would be restricted to a single paragraph. Please inform yourself on the difference between a paragraph as a blank line (or \par) in comparison to the sectioning command \paragraph. – Johannes_B Nov 27 '13 at 18:31