Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For a given work, I have to number some selected paragraphs, with a continuous numerotation throughout all the book. I can do it using this tip.

I need the index entries refer to the paragraph numbers and not to the pages. I've seen this post, but I'm not able to customize it for my need, as I am quite a newbie to LaTeX and I don't understand which part of the implemantation I should change to refer to the numbered paragraphes...

Till now, I've not choosen the document class -- as the tip for numbering some selected paragraphs is for memoir, I think I will use it.

Thanks for your help.

share|improve this question
    
Welcome to TeX.SX! We should know how you provide the paragraph numbers in order to help you. –  egreg Jul 17 '12 at 20:49
    
Ok, sorry for the URL links and not the complete solutions I've used, I will not them directly in the message the next time. –  Ratoune2008 Jul 18 '12 at 13:02
add comment

1 Answer

Following the example you give, using the memoir class, here is a simple way to implement what you want. Memoir may be a good option if you have precise, complex needs, because it is very comprehensive, especially for long documents.

Because memoir's \frontmatter, \mainmatter and friends alter the way section numbering is done, I suggest you create a whole new counter, since you are not really using it as a sectioning command anyway. If you need to add the paragraphs to the table of contents, it is possible too, so no worries there (just ask).

Here is the example document:

\documentclass{memoir}

% Load dummy text
\usepackage{lipsum}

% We create a counter
\newcounter{paracount}

% We create the paragraph command
\def\para{%
    \refstepcounter{paracount}%
    \noindent\textbf{\theparacount.\quad}}

% We create an index
\makeindex

% We tell memoir to index paragraphs and not pages
\renewcommand{\index}[1]{\specialindex{\jobname}{paracount}{#1}}


\begin{document}

\frontmatter

\para \index{Front matter entry} \lipsum[4]

\mainmatter

\para \index{First entry} \lipsum[1]

\para \index{Second entry} \lipsum[2]

\para \index{Third entry} \lipsum[3]

\printindex

\end{document}

Note that you can tell memoir to index things based on any counter, you just need to specify it in the \specialindex{\jobname}{<counter>}{#1} line.

Now, all you need to do is run LaTeX, then MakeIndex, then LaTeX again.

share|improve this answer
    
Thanks a lot, @ienissei, it's exactly what I wanted to do. I will study better the Memoir class, which seems really powerful... –  Ratoune2008 Jul 18 '12 at 13:04
    
Just a question more about that special way of numbering paragraphs : it does not work using \frontmatter, \mainmatter and \backmatter. I've tried to add a \setsecnumdepth{paragraph} command, as it is suggested in this other discussion : tex.stackexchange.com/questions/3327/…, but there is no effect. –  Ratoune2008 Jul 18 '12 at 14:24
    
@Ratoune2008 Ah… yes, that will be memoir messing up with section numbering within the \frontmatter and \mainmatter commands. I have edited my answer, I suggest you just use a new counter, as you don't actually need your entries to be \paragraph sections as such. –  ienissei Jul 18 '12 at 17:27
    
Thanks a lot, you're an expert... and thanks for the explanations of the commands you define, it helps to understand better both LaTeX and 'memoir' class ... –  Ratoune2008 Jul 18 '12 at 19:04
    
@Ratoune2008 Glad it helped :) –  ienissei Jul 18 '12 at 20:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.