LyXFloating paragraph number

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Floating paragraph number

Post by auvajs »

Let's say the paragraphs are numbered in my document

Code: Select all

\renewcommand\theparagraph{§\arabic{paragraph}}
I need to write something like: "regulations of §34 apply in this case" many times in the document. However if I change that (34) paragraph number, I had to change all those references as well which would be very demanding.

Is there some way how to do it automatically?
Last edited by auvajs on Sun Jan 15, 2012 4:13 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Floating paragraph number

Post by Stefan Kottwitz »

You could use \label and \ref for cross-referencing. You don't need numbers, they are automatically determined by LaTeX. For example:

Code: Select all

\documentclass{article}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{4}
\renewcommand\theparagraph{§\arabic{paragraph}}
\begin{document}
\paragraph{Introduction}\label{p:intro}
This is a paragraph. Paragraph \ref{p:main} follows.
\paragraph{Main}\label{p:main}
This is a paragraph. See also paragraph \ref{p:intro}.
\end{document}
paragraphs.png
paragraphs.png (13.72 KiB) Viewed 2747 times
Stefan
LaTeX.org admin
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Re: Floating paragraph number

Post by auvajs »

Thank you, Stefan, it works. However, the reference is closed in a little red rectangle. How to remove the rectangle? I don't want it in my PDF document.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Floating paragraph number

Post by Stefan Kottwitz »

That's caused by hyperref. You could switch it off after you loaded that package:

Code: Select all

\hypersetup{colorlinks=false, pdfborder={0 0 0}}
Stefan
LaTeX.org admin
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Re: Floating paragraph number

Post by auvajs »

Danke noch einmal!
Post Reply