Articles of cross referencing

Repeat the Entire Labeled Text upon Referencing

I would like for the text of an item in and enumerate environment to be repeated automatically upon referencing. This is similar to MS Word’s cross-referencing option for inserting entire text. Can also be applicable to captions. \documentclass{article} \begin{document} \begin{enumerate} \item Item 1 …\label{item:1} \item Item 2 …\label{item:2} \item Item 3 …\label{item:3} \end{enumerate} In Item~\ref{item:1} […]

Have latex warn when I refer to an item that occurs later?

I’m writing a long mathematics book. Sometimes after I move things around, an internal reference (\ref{…}) will refer to an item that occurs later in the text. For example, a proof may (unintentionally) require something proved later in the book. Is it possible to have LaTeX automatically warn of this?

Reference with compound labels

I created an environment, Procedure, using the package tcolorbox. The procedures are numbered by \thechapter-\theproc and I would like to use cleveref to refer to them. Here is a minimum working example in which I can’t figure out how to cross-reference \label{proc:One} using \cref. \documentclass{book} \usepackage{tcolorbox} \newcounter{proc}[chapter] \newtcolorbox{Procedure}[1]{title=#1} \usepackage{cleveref} \begin{document} \chapter{First Chapter} \label{ch:First} \refstepcounter{proc} \label{proc:One}% […]

What does amsmath do to \@currentlabel?

Can someone explain what amsmath does to \@currentlabel in the align environments? Better yet: if I want to write what would be expected to be the \@currentlabel together with some other information into an auxiliary output file, what’s the best way to access that information in the align environments? \documentclass{article} \usepackage{amsmath} \makeatletter \newcommand\storelabel[1]{% \xdef#1{\@currentlabel}} \makeatother […]

a recommended style guide for sustainable referencing in large documents

I am beginning to write more and more reports which are ever growing in size, typically about 60-100 pages, containing multiple sections, appendices, etc. However, I am finding my current system/style for labeling my figures, sections, etc., is not ideal and isn’t scaling that well. Soon I will be writing my PhD thesis and want […]

Remove math from command parameter to get only the letters

I use a little command, which prints new defined terms in bold, adds a label and adds them to the index. \newcommand*{\defined}[1]{{\bf #1}\label{#1}\index{#1}} Now if I do \defined{$G$-invariant} the label isn’t working and the index entry is ordered in the wrong place. I think that’s got to do with the math dollar sign. Is there […]

global relabeling of all figures

Can I global change all figures and references to figures up one starting from figure 10? So figure 10 and all references to 10 become 11 and so on? I should probably add that I have about 30 figures and added a figure right above figure 9 displacing my current count. That is why I […]

Working with labels

I’m not quite sure what the problem is, so I’ll just post a MWE: \documentclass{article} \newcommand\twolabels[2] { \label{my:#1} \label{my:#2} } \begin{document} \twolabels{4}{a} I have two labels: \ref{my:4} and \ref{my:a}. \end{document} Instead of referring me to 1 and 2, it gives me two ??’s. Where am I going wrong?

Hide content to show later

My question appeared about this egreg’s answer: https://tex.stackexchange.com/a/210564/15256 I have a list of exercise-answers but I don’t want to show the answers immediately but after till I’ll pull with a command and fetch all the answers till there. By example: \hidesolutions \begin{exercise} this is an exercise.1 \end{exercise} \begin{solution} this is a solution for the above […]

How to cross-reference inside of a verbatim (or listings) environment

I would like to reference other parts of my document (e.g. equations, figures) inside of some source code. Is there an escape sequence such that \ref will be parsed instead of printed as a literal \ref? My minimal example is as follows: \documentclass{article} \usepackage{amsmath} \usepackage{listings} \begin{document} This is the pythagorean theorem: \begin{equation}\label{eq:pyth} a^2+b^2=c^2 \end{equation} I […]