Paragraph 1: Lie groups represent the best-developed theory of continuous symmetry of mathematical objects and structures, which makes them indispensable tools for many parts of contemporary mathematics.
...
As discussed in Paragraph 1 we conclude ...
I would like to use references, i.e. something like this:
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Are these »Paragraph 1« like paragraphs actually parts that should be indicated by a sectioning command but should not appear in the table of contents? In that case I would probably use a customized \paragraph and set the counters secnumdepth and tocdepth accordingly. Here is an example:
\documentclass{article}
\usepackage{lipsum}% dummy text
\setcounter{tocdepth}{3}% subsection level
\setcounter{secnumdepth}{4}% paragraph level
\renewcommand{\theparagraph}{Paragraph~\arabic{paragraph}}
\makeatletter
\renewcommand\paragraph{%
\@startsection
{paragraph}% name
{4}% level
{\z@}% indent
{3.25ex \@plus1ex \@minus.2ex}% beforeskip
{-1em}% afterskip, a negative value creates a run-in heading
{\normalfont\normalsize\noindent}% style: the only value I have changed
}
\makeatother
\begin{document}
\tableofcontents
\section{Foo Bar}
\paragraph{}\label{par:mylabel} \lipsum[2]
In \ref{par:mylabel} we talked about \ldots
\end{document}
More fine control over the layout for the \paragraph command would be possible through the titletoc package instead of LaTeX's low level command \@startsection that I have used here.
Well, LaTeX's labels always refer to a counter, i.e. a specific number associated with something like a section or a table caption. The \ref command always only prints the value of the corresponding \the<counter> macro which means you'll get the referenced number. For what you want one would need to define a different label/reference system that writes the words you want to have saved to the aux file and a custom ref command that retrieves it. Maybe this (note that it needs two compilations):
\documentclass{article}
\makeatletter
% #1: id
% #2: word to print
\newcommand*\savelabel[2]{%
\immediate\write\@auxout{%
\noexpand\global\noexpand\@namedef{mylabel@#1}{#2}}%
#2%
}
% #1: id
\newcommand*\getlabel[1]{%
\ifcsname mylabel@#1\endcsname
\@nameuse{mylabel@#1}%
\else
??%
\fi
}
\makeatother
\begin{document}
Before: \getlabel{labelname}
Use \savelabel{labelname}{Legendre} in the text
After: \getlabel{labelname}
\end{document}
You can also use this with hyperref, by the way. It has the macros \hypertarget{<label>}{<text>} and \hyperlink{<label>}{<text>} that could be used by themselves or included in the above definition:
\documentclass{article}
\usepackage{hyperref}
\makeatletter
% #1: id
% #2: word to print
\newcommand*\savelabel[2]{%
\immediate\write\@auxout{%
\noexpand\global\noexpand\@namedef{mylabel@#1}{#2}}%
\hypertarget{#1}{}%
}
% #1: id
\newcommand*\getlabel[1]{%
\ifcsname mylabel@#1\endcsname
\hyperlink{#1}{\@nameuse{mylabel@#1}}%
\else
\textbf{??}%
\fi
}
\makeatother
\begin{document}
Link before the paragraph: \getlabel{labelname}
Some text about \savelabel{labelname}{lorem ipsum} lorem ipsum dolor \ldots
Link after the paragraph: \getlabel{labelname} and before the next:
\getlabel{another}
Another label\savelabel{another}{another}
\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p