Page LayoutHow Do I Use \label if I Just Want to Label Text?

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
nyknicksfan
Posts: 3
Joined: Sat Sep 26, 2009 4:07 am

How Do I Use \label if I Just Want to Label Text?

Post by nyknicksfan »

So below I've listed the basic code for my document {PACKAGES HAVE BEEN OMITTED}. I basically have a lot of sentences that I would like to put subscripts on, or at least label, and then recall them in later sections. (In other words, use the command \label for text}

For example, in the procedure section, a sentence reads, "I used the quadratic formula." I want use \label on this sentence, so I use \ref in a later section (Additional Information). However, for every sentence that I use \label with within the section Procedure, the reference numbers are all the same because the \label command is labeling the entire section as opposed to the specific text I want to label.

\documentclass[12pt]{article}

\begin{document}

\tableofcontents
\newpage
\begin{doublespacing}
\section{Procedure}
\input{Procedure}
\section{Additional Information}
\input{Additional_Information}

Recommended reading 2024:

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

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

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: How Do I Use \label if I Just Want to Label Text?

Post by josephwright »

The cross-references need something to point at. Sentences don't have that: they are just sentences. I'm intrigued about how you feel this will look. Is there an example you can point us to?
Joseph Wright
nyknicksfan
Posts: 3
Joined: Sat Sep 26, 2009 4:07 am

Re: How Do I Use \label if I Just Want to Label Text?

Post by nyknicksfan »

Well, in class I completed a lab exercise, and the write up is supposed to include a procedure and an error analysis (qualitative and quantitative). I was thinking about combining the procedure with a qualitative error analysis, and then cross-referencing these qualitative errors with a different section, the error analysis section, where the qualitative errors are explained quantitatively.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How Do I Use \label if I Just Want to Label Text?

Post by localghost »

Just a hint. Somebody asking for an example wants to see some code in the sense of a minimal working example (MWE).


Best regards and welcome to the board
Thorsten
nyknicksfan
Posts: 3
Joined: Sat Sep 26, 2009 4:07 am

Re: How Do I Use \label if I Just Want to Label Text?

Post by nyknicksfan »

Oh, sorry about that. I actually don't know of a working example that does what I'm asking for, but here is the "working" code for my document.

\documentclass[12pt]{article}

\usepackage{indentfirst}
\usepackage{setspace}
\usepackage{geometry}
\usepackage{endnotes}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{wasysym}
\usepackage{rotating}
\usepackage{url}
\usepackage{caption}

\geometry{left=.95in,right=.95in,top=.95in,bottom=.95in}

\begin{document}

\tableofcontents
\newpage
\begin{doublespacing}
\section{Procedure}

...One mark was made as far from the petri dish as possible; the other was about an inch from the petri dish. \label{exitbeam}$_{\ref{exitbeam}}$

%The _ used before \ref is to subscript the reference number.

...Nonetheless, lines from the center point were extended through the points of incidence and refraction. \label{circlecenter}$_\ref{circlecenter}$

\section{Error Analysis}

\ref{exitbeam}: The uncertainty this adds to the uncertainty of theta is one degree.

\ref{circlecenter}: The position of the circle's center increases the uncertainty of theta by another degree.

%As you can see, in the compilation, the reference number for both labels is the same because they are labeling the section rather than the text.

\end{doublespacing}
\end{document}
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: How Do I Use \label if I Just Want to Label Text?

Post by josephwright »

I was thinking of an occasion where someone has done something similar to what you want. Could be done in a word processor or page layout app, for example.
Joseph Wright
Post Reply