3
votes
1answer
61 views

Creating own ref-label system without using additional parameters using newcommand? [closed]

is there any possibility to create a command by to make a reference without using additional parameters? I would use something like \newcommand{\something}[#1]{\label{#1}} Is it possible to do it ...
3
votes
2answers
200 views

Macros formatting/arranging words {A_1}{A_2},…{A_n} into predefined paragraph for varying n and tagging

How does one robustly (without breaking most environments) construct the macros with arbitrary number of parameters that output the parameters into a predesigned paragraph such that several of these ...
3
votes
3answers
147 views

ConTeXt: Prevent Reference Name Clashes in Floating Objects of Different Types

I find it very annoying that ConTeXt uses the same namespace for references of floating objects. In other words, if you give the same reference to a figure and a table, then you'd always refer to the ...
9
votes
1answer
313 views

Macro to automatically save section name of previous section and next section

EDIT: I've edited the code that reproduces the anomalies, but I'll work on the code to more accurately depict the problem later on the day. Weird spacing in index Index doesn't appear in footlinks / ...
2
votes
0answers
56 views

\ref to \label in other document?

I have a repository with one document, but I think of splitting it into two documents, whereas I want to cross-reference from one to eachother. Is there a way, to "rewrite" \ref to automatically ...
4
votes
2answers
122 views

Build kind of a \includeonlypart for Beamer

(This is a follow-up to a previous question that recieved an answer, but raised a new issue that is presented here) Goal Given that (as far as I know) Beamer doesn't provide a way to include only a ...
2
votes
2answers
124 views

Why can't I renew the \label command in math mode?

When I'm writing a paper and want to refer to a section, figure or equation in a different part of the document, I end up spending a lot of time scrolling through my source code so that I can see what ...
4
votes
0answers
84 views

Format \ref as a roman numeral? Strange bug [closed]

How do I get a \ref to format as a Roman numeral? At the moment I have the code: \newcommand{\appendixref}[1]{Appendix~\romannumeral 0\ref{#1}\relax} This works great... except for when it ...
3
votes
1answer
118 views

Leading zeros when cross referencing

I have a custom counter and output it with leading zeros. When I reference it, I get some real strange output, but the enumeration itself works. Preamble: \newcounter{reqcount} ...
4
votes
1answer
55 views

Alternative eqref command (generating a footnote)

Sometimes I think it is helpful to have a visual reference to a cited equation, besides its reference number. Let me give a (manual) example of what I'm talking about: \begin{document} (...) ...
0
votes
0answers
44 views

Choosing what to \ref from a \newcommand

I have this definition in my class (thanks to this answer): \newcommand\clause{% \immediate\write\@auxout{\string\expandafter\gdef\noexpand\csname ...
6
votes
1answer
111 views

@namedef and math mode

I am trying to do something simple: I want to be able to store and retrieve texts and equations via labels. In particular, I want something like \labelput{<label>}{<text>} % sets the ...
8
votes
1answer
574 views

How to make \hl (highlighting) to automatically place incompatible commands in \mbox?

The soul package provides a useful command \hl for highlighting text. However, \cite, \ref, and some other commands (maybe equations too) must be placed within an \mbox in order for \hl to work ...
3
votes
1answer
122 views

Editing cleveref's format for multiple label references

I am using the cleveref package to refer to theorems, equations, etc, in an article (LaTeX). I wish to have the format of reference as: Thm. (1) for single theorem (or equation, figure, etc) and Thms. ...
0
votes
0answers
27 views

AucTex region preview produces a document with ~10× more pages than the region preview should be. Cached preamble issue?

I define the following \locallabels{} command to localize labels and references to a certain part of my document \makeatletter \AtBeginDocument{% \let\origlabel@in@display\label@in@display ...
3
votes
1answer
164 views

How to cross-reference several objects simultaneously

I want to define a macro for referencing equations in an article. I want the equation to be referenced as: " Eq. (3) " So I defined a command "\eref{}" as: \def\eref#1{Eq.~\ref{#1}} But I also have ...
2
votes
1answer
200 views

new command for including a custom string into \cref

In this thread here: Subfigure labelling for a single figure I suggested a solution how to include a custom string into the hyperlink created by the \cref command. I'd like to create a compact new ...
5
votes
1answer
346 views

Concatenate two strings to make a new command

I took some habits with my sciences reports so I developed some personalized commands. First, I define in the preamble all the variables that I need like this: \newcommand{\cvba}{Cv_{\beta/\alpha}} ...
2
votes
1answer
154 views

using a restatable before it is stated

This question is related to the question at Recalling a theorem, which uses the thmtools and thm-restate packages and the restatable environment to define a theorem that can be re-stated later on. Is ...
5
votes
1answer
222 views

Label and page number in macro?

I'm writing a long document, and I've written a little macro for keeping track of various things I want to come back to - for example if I want to continue writing but I know that something I've ...
5
votes
1answer
116 views

re-define \ref and \label to include source filename?

I have a set of documents each with references that look like: \ref{figure1} and so on. This is no problem when building each document separately,but creates many duplicate references when using ...
3
votes
2answers
125 views

Is it possible to declare a footnote in a way that it will attach to the first occurrence of a given word or phrase?

Is it possible to declare a footnote in a way that it will attach to the first occurrence of a given word or phrase? Doing this in a fully automated way might not be possible (see link below), but if ...
5
votes
3answers
140 views

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} ...
2
votes
1answer
207 views

Re-insert equation by label

I read over the response given here: Is it possible to re-insert a LaTeX equation by label? which says such a thing is possible only with a macro. I would like to do this. I have a bajillion ...
3
votes
2answers
269 views

How can I refer to label created by new command?

I have several pairs of graphs. I need to display these graphs in latex. I am using the following which works Great. \begin{figure} \centering \begin{subfigure}{.5\textwidth} \centering ...
1
vote
0answers
79 views

Is it possible to make a macro with \label? [closed]

I'm not very experienced with LaTeX and I'm having trouble when trying to define a macro to include some images. I want to do it this way because I'm trying to take notes using LaTeX and I need to ...
1
vote
1answer
127 views

Macro needed for automatic creation of labels

I'm asking for help with the creation of a label inside a command out of a given text. The given text contains spaces and an umlaut. See my MWE, which contains my question: \documentclass[pagesize, ...
5
votes
1answer
668 views

Shortcut commands for referencing floats

I always include the following commands in the preamble of my latex documents to make sure I refer to floats consistently in the text. I was wondering if the community had any thoughts about this, is ...
7
votes
2answers
402 views

How to use \csname … \endcsname with \ref?

I have to get value of a dynamical macro where the index is given by \ref{mymarker}. Is it possible to do? I define a set of macros with a predefined counter 'mycounter' as ...
14
votes
1answer
620 views

How to create my own ref label system?

I want to add a hyperlink to sections where a file is discussed. Additionally the usage should be added to the index. In principle this is very close to the label ref system. A simple approach would ...
11
votes
2answers
409 views

using \nameref only if there is a name

I am referencing some sections (actually those will be custom defined in the end) by number, type and name. But it happens that there is no name. So I want to leave it out. How can I test for that? A ...
1
vote
2answers
147 views

Ref list listing arg instead of actual argument's text in a newcommand

What i'm trying to do is to set up a quick insert of a pdf at a default size with the new command \zfh. The problem lies with the label and how it's listed in my label list database. example: ...
3
votes
1answer
74 views

Using \label command in a custom command

I have some big equations that I wanted to separate out of the text of my document to make the source code easier to read. The idea was to declare a command for each equation in a separate file, ...
5
votes
1answer
420 views

How to programmatically create sections in LaTeX

In the simplest form of the problem I am facing, I need to define a command that accepts two parameters, uses the first to put some contents in the document exactly where the command is invoked, and ...
11
votes
3answers
2k views

Get reference to “current” section

I'd like to write a command to get a reference to the "current" section provided (the term is all wrong, but the example will clarify). The idea is something along the lines of: ...
5
votes
2answers
391 views

Comparing reference numbers

I'm using the refcount package to get the reference number associated with a label. I'd like to determine whether two references lay "next" to each other or not, that is: I'd like an expandable ...
2
votes
1answer
234 views

Call macro whose name depends on macro

Sorry about the title, I really couldn't find a better one. I'm facing the following dilemma: I'm using the smartref package, in particular I'm using its \sgetXval macros. The thing is that I'm using ...
2
votes
2answers
281 views

Customize referencing of subcaptions in “memoir”?

When I use \subcaption{... \label{myfig}} in memoir, and then reference it, the result is something like "Figure 1(a)". But I would like to customize the reference by removing the parentheses, thus ...
13
votes
2answers
384 views

Compress a list of page references

I'm looking for a pure (La)TeX solution (alas, no LuaTeX) for compressing a list of page references (given with \pageref) like cite.sty does with citations; that is "Compress lists of three or more ...
2
votes
2answers
310 views

What do these cross-referencing and code macros mean?

I was searching around my editor and found some templates that I never used before and I was just wondering exactly what do they mean and do. Someone can edit the title is you have a better ...
8
votes
4answers
483 views

Making an “auto-counter” command - test whether a reference marker already exists?

I'd like to be able to number arbitrary objects (in my case, chemical compounds) within a document. Ideally this would involve a command a bit like \ref, but where you don't need a \label. The label ...
6
votes
1answer
693 views

Define a custom command with name, label and linkable

I'd like to create a command with the following features: \newcommand{\mycom}[2]{...} \newcommand{\linktomycom}[1]{...} In the doc body: \mycom{firstitem}{This is the first item} and later: ...
4
votes
1answer
367 views

Define command so that \label works properly

I have something like this: \newcounter{Def} \newcommand{\printDef}{\thechapter.\thesection.\theDef} \newenvironment{Expl} {\small\narrower\medskip\stepcounter{Def}\noindent\ignorespaces ...
1
vote
1answer
508 views

Defining a custom cross referencing style

I want my cross reference links to look like: Chapter X: Chapter Title To achieve that I have created the following command: \newcommand{\fancyref}[1]{\autoref{#1}: \nameref{#1}} The problem is ...
18
votes
4answers
648 views

How exactly does \def\p@figure{Figure~} work?

I took this line from my thesis style and added it into my document (preceded by \makeatletter) and what it does that whenever I used \ref{figureid} instead of putting just the figure number, it puts ...
4
votes
1answer
111 views

Defining a command for linked and indexed section headings?

What is the (preferred way of) defining a command that places a heading (like \section, \chapter, etc.) creates a label for this heading that can be referenced places the heading in the TOC (I ...