I'm trying to get a numbering of the paragraph on my book in a similar fashion as this example. The manual approach works fine, but now I'm considering two extension cases.

1) Automated numbering

Ideally, I was wondering if the automated numbering could be simple to put in place. In the simplest form, I'd assume that each new paragraph get this command, a bit like (I assume) "parindenting works" for the indent in the paragraphs.

Ideally, this mechanism should also be "temporarily" disabled, if needed. This would be similar as the \noindent command for paragraph indenting. From my searches here or here, the use of \everypar is discouraged. But these posts are relatively old (resp. 2012 and 2015) and I was hoping for a better solution.

So is there any new "hook" to do that ?

2) Two-side version of the code

Secondly, I may have to work with document which are of the "book type" and hence are two-sided. I found one example here. In that case, I'd get that the numbering on the left side if the page is on the left and numbering on the right for the right page.

This is important, especially for the margin, which may not be exactly the same, but symmetric. Moreover, if the book has a binding, then there is a risk that the paragraph number may disappear under the binding.

Is there a good mechanism to do it automatically too, especially if with a conditional toogle retrieving the "twoside" options of the document class? The examples I found seems to be either/or version. Ideally, I'd like to be able to change the style without having to renew the command.

  • The two-side version of the code should not be a problem. There are margin-commands that choose the outer margin automatically (and thus alternate between left and right in a two-sided layout, take the accepted answer to tex.stackexchange.com/q/10513/35864 for example). The much bigger challenge is point (1). I don't think this hook you are looking for exists (apart from \everypar which is used too often in other capacities as well). As far as TeX and LaTeX core development is concerned, six years are nothing ... – moewe May 17 '18 at 13:35
  • ... While some packages and LaTeX3 may have progressed a lot since then, TeX and the LaTeX kernel value stability. So if changes are made, they are usually small (but even then can cause quite some commotion), I don't think Knuth's TeX has changed at all in the last ten years. LaTeX2e has been moderately changed, but not in a way that could help you here. – moewe May 17 '18 at 13:42
  • dickimaw-books.com/latex/admin/html/numpara.shtml might be of interest. But again the gist is: \everypar does almost what you want. It may look good at first, but can break in all sorts of situations and needs workarounds. You'll most certainly end up with something that is not really portable and specifically tailored to your document and its document class. – moewe May 17 '18 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.