1

I'm using the \setcounter{secnumdepth}{} feature to number my paragraphs. However, LateX only numbers paragraphs explicitly defined with \paragraph. Is there a way to make regular "implicit" paragraphs (i.e. separated only by newlines) numbered too? I'd like to keep the markup in my documents to a minimum.

\documentclass{article}
\begin{document}
\setcounter{secnumdepth}{5}

\section[intro]{Introduction}
Some stuff goes here

\section[scope]{Scope}

A new paragraph, I wish it had numbers

Another paragraph.  It'd be nice to have numbers

\paragraph{}
This one has numbers because it's explicit

\paragraph{}
And so does this one

\end{document}
  • Is this a duplicate question? http://tex.stackexchange.com/questions/231837/paragraph-numbering-lineno-for-paragraphs – Paul Stiverson Jun 19 '15 at 13:53
  • I think it may be, and the linked question includes an answer, but the paragraph numbering in the answer is independent of chapter/section/subsection numbering. I may play with it and post something here if I get it working. – JohnWoltman Jun 19 '15 at 14:11
  • There are at least 4 other questions pertaining to paragraph numbering in TeX.SE. Searching "Paragraph number" with the search bar in the upper-right corner of the page yields many fruit. – Paul Stiverson Jun 19 '15 at 14:14
  • This is easy or hard to do depending on what's in the actual document. Many environments use things like \par and \endgraf (and related commands), which can mess up "automatic" numbering of paragraphs. In such cases, it is often better to start each paragraph with a command like \pnum, which you can define to do what -- and look how -- you want. – jon Jun 19 '15 at 14:16
  • Thanks Paul. I read through the other paragraph numbering questions and decided to stick with the defaults for now, because I'm not familiar enough with LaTeX. I don't want to depend on non-standard code that I don't understand, because I won't be able to fix it when it breaks. I'll just put \paragraph commands in my text. – JohnWoltman Jun 19 '15 at 14:42
  • @JohnWoltman \paragraph *is not intended for the creation of paragraphs. It is a sectioning* command like \section or \subsection. Do note that every time you say \usepackage{}, you are loading non-standard code which you (presumably) don't understand and won't be able to fix when it breaks. The code in venturisadf is just as non-standard as anything I post here. The fact that I threw it on CTAN does not improve the quality of the code one iota. Note that I'm not encouraging you to copy-paste code you don't understand. But don't imagine that packages meet any quality standard. – cfr Jun 20 '15 at 01:13
  • @cfr, since \paragraph is the built-in way to number paragraphs, that's what I'll have to use. I aliased it to \p so it's not as visually distracting. As for non-standard code, there are many packages that are part of a typical Latex install, and so can be depended on to probably work in the future (like hyperref, which is excellent). Since I'm still learning Latex, I'm assuming that packages included in my distro of choice will be around for awhile. – JohnWoltman Jun 20 '15 at 05:35
  • I don't see anything especially wrong with using it that way as long as you are clear what you are doing. But it is not 'the built-in way to number paragraphs' any more than \chapter or \subsubsection or \subparagraph are. They are all sectioning commands. It is unfortunate that \paragraph is called \paragraph as it leads people to think it is like HTML's <p>...</p> which it is not. It would be better to use autocompletion in your editor than to define \p to be \paragraph, though. However, I doubt that you will believe me. (Not personal: I wouldn't have believed me either.) – cfr Jun 20 '15 at 14:01
  • \paragraph is not for numbering paragraphs it is the 4th level section heading so should only be used after \subsubsection not after \section as cfr said. If you are still interested in this, the new test release of latex includes paragraph hooks that can probably be used to answer the original request to number paragraphs with no markup – David Carlisle Jul 01 '21 at 16:31

0 Answers0