Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LaTeX Template HsH
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Wille
LaTeX Template HsH
Commits
e7d59fe7
Commit
e7d59fe7
authored
3 years ago
by
Jan Wille
Browse files
Options
Downloads
Patches
Plain Diff
sec: cross-referencing
parent
f9da1a7a
No related branches found
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
example.pdf
+0
-0
0 additions, 0 deletions
example.pdf
example.tex
+23
-0
23 additions, 0 deletions
example.tex
with
23 additions
and
0 deletions
example.pdf
+
0
−
0
View file @
e7d59fe7
No preview for this file type
This diff is collapsed.
Click to expand it.
example.tex
+
23
−
0
View file @
e7d59fe7
...
@@ -302,6 +302,29 @@
...
@@ -302,6 +302,29 @@
normal space
&
\lstinline
|
\space
|
&
in case some command eats up all your space
\\
normal space
&
\lstinline
|
\space
|
&
in case some command eats up all your space
\\
\end{tabular}
\end{tabular}
\section
{
Cross-referencing
}
\label
{
sec: referencing
}
When writing you will often have to reference something else in your document. Of course, you don't want to manually type the number you are
referencing and have to redo it whenever you add/delete a chapter (and surely forgetting something). That's why LaTeX does this for you and
you don't have to worry about it!
For this to work, you have to give unique names to everything you might want to reference. This is done with the
\lstinline
|
\label
{
name
}
|
command, which you just put after whatever you are labelling (it doesn't matter if it's on the same line ore the next). The name can be
everything you like, but choosing something you will easily remember later makes sense. I also recommend prefixing the label names with a
descriptor for what it's referring to, for example
\lstinline
|
\label
{
chap: ...
}
| for chapters,
\lstinline
|
\label
{
fig: ...
}
| for figures and so
on. That way you can have a chapter and a figure with the same name while still having unique identifiers.
\medskip
To later refer to a label, you use the
\lstinline
|
\ref
{
name
}
| command, which will create the number of the labelled item, for example, this is
a reference to chapter
\ref
{
chap: latex
}
. You can now click the "1" and be taken to the corresponding chapter.
To make this easier and create a bigger, better clickable link, this classes load the
\lstinline
{
hyperref
}
package, which introduces the
\lstinline
|
\autoref
{
name
}
| command. This automatically adds the name of whatever you're referencing before the number, like this:
\autoref
{
chap: formating
}
.
\medskip
For easy use, I recommend you work with a decent editor, which automatically detects all labels and suggest them to you whenever you type a
reference.
\chapter
{
Examples
}
\label
{
chap: one
}
\chapter
{
Examples
}
\label
{
chap: one
}
{
\color
{
red
}
red text
}
and
{
\color
{
blue
}
blue text
}
\\
{
\color
{
red
}
red text
}
and
{
\color
{
blue
}
blue text
}
\\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment