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.

It is well-known that \section environment may be assigned a label \label{refname} and then the refname may be used in order to reference this section:

\section{My nice section}
\label{sec:my-nice-section}
Definitely the section is nice!

\section{My another section}
In the section \ref{sec:my-nice-section} we have discovered that it is nice.

Is there such possibility for \paragraph that we can assign it a label and then reference it?

share|improve this question

2 Answers 2

up vote 22 down vote accepted

Sure - if it has a number which can be referenced:

\documentclass[10pt,twocolumn]{article}
\setcounter{secnumdepth}{6}
\begin{document}
\paragraph{blub}\label{para}
abc paragraph \ref{para}
\end{document}
share|improve this answer
3  
\setcounter{secnumdepth}{6} is the answer, thanks –  Tim Dec 23 '10 at 12:00

Here another approach which I find more direct, easy, and appropriate to the question posted above (source: wikibooks):

%The link location will be placed on the line below.
\phantomsection
\label{the_label}

The good thing is that \ref{} will produce the number of the section the paragraph is entailed, \pageref{} will produce the pagenumber where the paragraph is to be found and if hyperlinks are produced automatically with e.g. the hyperref-package clicking on the link beams one to the beginning of the referenced paragraph, ... so correct, consistent, and userfriendly behaviour! :-)

share|improve this answer
1  
But it won’t work the way the OP wants, as long the \paragraph is without a number. –  Speravir Oct 17 '12 at 17:53
    
Jip, but if a direct paragraph-number is needed it maybe would be wiser to go for a section / subsection / subsubsection / ... which does the numbering automatically because paragraphs are thought to be not numbered. –  Peter M Oct 18 '12 at 8:22
    
Ultimately, wouldn't you want your text to say something like ".... as described in the 2nd paragraph in section X.Y" or "...paragraph 2 in section X.Y addresses this point...". So therefore, whilst you may not display a number like in a chapter, section or subsection, maybe define a new counter, and set the \par command to increment the counter. Resetting the counter at start of new section, subsection or chapter etc... –  Nicholas Hamilton May 16 '13 at 11:35
    
Again, if something is so important that it needs explicit numbering, why not go for a build in solution with section, subsection ... IMHO: Either I would write "as described in section\ref{sectionlabel}" or I would go for "As described on page~\pageref{phantomsectionlabel}" ... Either way, the solution above makes referring to paragraphs possible - that was the question. It has small overhead. It is good style. (IMHO) ... if you do not like it and you insist on counting paragraphs go for solutions which have more overhead like the one of Ulrike Fischer posted here. –  Peter M Feb 5 at 11:28
2  
+1 I like not having to give the paragraph a number. I can reference the section it goes to and have it land on the exact paragraph. –  spdickson Mar 7 at 22:25

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.