Removing label from a stringAutomatic theorem listUsing variables in constructing new labelssticky labels...
What is this high flying aircraft over Pennsylvania?
Friend wants my recommendation but I don't want to give it to him
Is there a distance limit for minecart tracks?
Writing in a Christian voice
What is the meaning of "You've never met a graph you didn't like?"
Travelling in US for more than 90 days
Why doesn't Gödel's incompleteness theorem apply to false statements?
Do native speakers use "ultima" and "proxima" frequently in spoken English?
What properties make a magic weapon befit a Rogue more than a DEX-based Fighter?
Checking @@ROWCOUNT failing
Air travel with refrigerated insulin
C++ lambda syntax
"Marked down as someone wanting to sell shares." What does that mean?
How to get directions in deep space?
Can creatures abilities target that creature itself?
Why do Radio Buttons not fill the entire outer circle?
How do I lift the insulation blower into the attic?
Is divisi notation needed for brass or woodwind in an orchestra?
Can you take a "free object interaction" while incapacitated?
Mortal danger in mid-grade literature
Capacitor electron flow
"Oh no!" in Latin
Weird lines in Microsoft Word
How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?
Removing label from a string
Automatic theorem listUsing variables in constructing new labelssticky labels with image and textHow should I read the current TikZ “label distance”?x tick label style issue, anchor=east and text width command not working togetherCan I use cleveref and endnotes together?Retrieve link caption of hidden labelincludepdf addtolist label not workingUnresolved references label within caption for STATA tablesHow do I insert text in the main body conditional on whether or not a label is definedIs there any way to define the enumerate label in general?
Is there a way to create a command that removes, if present, a label
from some text. It should work like this:
documentclass{article}
newcommand{removelabel}[1]{} % some code
begin{document}
removelabel{label{some_label} This label should be removed} % output: 'This label should be removed'
removelabel{This string is already label-less} % output: 'This string is already label-less
end{document}
labels
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
|
show 5 more comments
Is there a way to create a command that removes, if present, a label
from some text. It should work like this:
documentclass{article}
newcommand{removelabel}[1]{} % some code
begin{document}
removelabel{label{some_label} This label should be removed} % output: 'This label should be removed'
removelabel{This string is already label-less} % output: 'This string is already label-less
end{document}
labels
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
May I ask why you need such a command? What should a leading label do?
– Kurt
Feb 17 at 2:06
see this for the full story. I'm trying to fix the bug shown in the code posted after 'EDIT: MWE showing the problem'. I'd call such a function on line 52, withBODY
as its argument.
– noibe
Feb 17 at 2:45
is a lualatex solution acceptable?
– JPi
Feb 17 at 3:27
@JPi not really
– noibe
Feb 17 at 11:00
Then I can't tell you. 😣
– JPi
Feb 17 at 12:24
|
show 5 more comments
Is there a way to create a command that removes, if present, a label
from some text. It should work like this:
documentclass{article}
newcommand{removelabel}[1]{} % some code
begin{document}
removelabel{label{some_label} This label should be removed} % output: 'This label should be removed'
removelabel{This string is already label-less} % output: 'This string is already label-less
end{document}
labels
Is there a way to create a command that removes, if present, a label
from some text. It should work like this:
documentclass{article}
newcommand{removelabel}[1]{} % some code
begin{document}
removelabel{label{some_label} This label should be removed} % output: 'This label should be removed'
removelabel{This string is already label-less} % output: 'This string is already label-less
end{document}
labels
labels
asked Feb 17 at 0:46
noibenoibe
512113
512113
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 11 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
May I ask why you need such a command? What should a leading label do?
– Kurt
Feb 17 at 2:06
see this for the full story. I'm trying to fix the bug shown in the code posted after 'EDIT: MWE showing the problem'. I'd call such a function on line 52, withBODY
as its argument.
– noibe
Feb 17 at 2:45
is a lualatex solution acceptable?
– JPi
Feb 17 at 3:27
@JPi not really
– noibe
Feb 17 at 11:00
Then I can't tell you. 😣
– JPi
Feb 17 at 12:24
|
show 5 more comments
May I ask why you need such a command? What should a leading label do?
– Kurt
Feb 17 at 2:06
see this for the full story. I'm trying to fix the bug shown in the code posted after 'EDIT: MWE showing the problem'. I'd call such a function on line 52, withBODY
as its argument.
– noibe
Feb 17 at 2:45
is a lualatex solution acceptable?
– JPi
Feb 17 at 3:27
@JPi not really
– noibe
Feb 17 at 11:00
Then I can't tell you. 😣
– JPi
Feb 17 at 12:24
May I ask why you need such a command? What should a leading label do?
– Kurt
Feb 17 at 2:06
May I ask why you need such a command? What should a leading label do?
– Kurt
Feb 17 at 2:06
see this for the full story. I'm trying to fix the bug shown in the code posted after 'EDIT: MWE showing the problem'. I'd call such a function on line 52, with
BODY
as its argument.– noibe
Feb 17 at 2:45
see this for the full story. I'm trying to fix the bug shown in the code posted after 'EDIT: MWE showing the problem'. I'd call such a function on line 52, with
BODY
as its argument.– noibe
Feb 17 at 2:45
is a lualatex solution acceptable?
– JPi
Feb 17 at 3:27
is a lualatex solution acceptable?
– JPi
Feb 17 at 3:27
@JPi not really
– noibe
Feb 17 at 11:00
@JPi not really
– noibe
Feb 17 at 11:00
Then I can't tell you. 😣
– JPi
Feb 17 at 12:24
Then I can't tell you. 😣
– JPi
Feb 17 at 12:24
|
show 5 more comments
1 Answer
1
active
oldest
votes
This is something I suppose could work for you:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabel#1letlabeloldlabel} % some code
begin{document}
begin{minipage}{textwidth}
removelabel{captionof{figure}{label{some_label} This label should be removed}} % output: 'This label should be removed'
end{minipage}
removelabel{This string is already label-less} % output: 'This string is already label-less
Figure~ref{some_label}
end{document}
In the output the label is not defined and returns questionmarks
Edit:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabelxdefremovedlabel{#1}letlabeloldlabel} % some code
begin{document}
removelabel{label{some_label} This label should be removed}
removedlabel
removelabel{This string is already label-less} % output: 'This string is already label-less
removedlabel
%Figure~ref{some_label}
end{document}
Now removedlabel
gives the string without the label... But I am not sure what you want to do... May be you should be more clear on what you expect from the command.
This code isn't actually removing the label, it just briefly changes the behaviour of thelabel
command to null. If I were to print the argument ofremovelabel
as if it was a string, I'd still seelabel{some_label}
.
– noibe
Feb 17 at 22:53
if you expand the argument of removelabel... it will not be there... If you want an argument of a command to be something and without even expanding it to disappear ane part of it... I am afraid it can't be done...
– koleygr
Feb 18 at 0:37
1
I suggestdefmyEmptyLabel#1{@bsphack@esphack}
.
– Ulrich Diez
Feb 18 at 21:55
@UlrichDiez.... you may write an answer because I don't really know what is these commands...
– koleygr
Feb 19 at 10:56
1
@koleygrlabel
shall not deliver visible things into the output-file/pdf-file.@bsphack
/@esphack
ensures that a space-token behind the argument of alabel
-command does not produce undesired visible whitespace in case there already was a space before thelabel
-command... Many of these commands are explained in source2e.pdf
– Ulrich Diez
Feb 19 at 13:44
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475268%2fremoving-label-from-a-string%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is something I suppose could work for you:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabel#1letlabeloldlabel} % some code
begin{document}
begin{minipage}{textwidth}
removelabel{captionof{figure}{label{some_label} This label should be removed}} % output: 'This label should be removed'
end{minipage}
removelabel{This string is already label-less} % output: 'This string is already label-less
Figure~ref{some_label}
end{document}
In the output the label is not defined and returns questionmarks
Edit:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabelxdefremovedlabel{#1}letlabeloldlabel} % some code
begin{document}
removelabel{label{some_label} This label should be removed}
removedlabel
removelabel{This string is already label-less} % output: 'This string is already label-less
removedlabel
%Figure~ref{some_label}
end{document}
Now removedlabel
gives the string without the label... But I am not sure what you want to do... May be you should be more clear on what you expect from the command.
This code isn't actually removing the label, it just briefly changes the behaviour of thelabel
command to null. If I were to print the argument ofremovelabel
as if it was a string, I'd still seelabel{some_label}
.
– noibe
Feb 17 at 22:53
if you expand the argument of removelabel... it will not be there... If you want an argument of a command to be something and without even expanding it to disappear ane part of it... I am afraid it can't be done...
– koleygr
Feb 18 at 0:37
1
I suggestdefmyEmptyLabel#1{@bsphack@esphack}
.
– Ulrich Diez
Feb 18 at 21:55
@UlrichDiez.... you may write an answer because I don't really know what is these commands...
– koleygr
Feb 19 at 10:56
1
@koleygrlabel
shall not deliver visible things into the output-file/pdf-file.@bsphack
/@esphack
ensures that a space-token behind the argument of alabel
-command does not produce undesired visible whitespace in case there already was a space before thelabel
-command... Many of these commands are explained in source2e.pdf
– Ulrich Diez
Feb 19 at 13:44
|
show 1 more comment
This is something I suppose could work for you:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabel#1letlabeloldlabel} % some code
begin{document}
begin{minipage}{textwidth}
removelabel{captionof{figure}{label{some_label} This label should be removed}} % output: 'This label should be removed'
end{minipage}
removelabel{This string is already label-less} % output: 'This string is already label-less
Figure~ref{some_label}
end{document}
In the output the label is not defined and returns questionmarks
Edit:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabelxdefremovedlabel{#1}letlabeloldlabel} % some code
begin{document}
removelabel{label{some_label} This label should be removed}
removedlabel
removelabel{This string is already label-less} % output: 'This string is already label-less
removedlabel
%Figure~ref{some_label}
end{document}
Now removedlabel
gives the string without the label... But I am not sure what you want to do... May be you should be more clear on what you expect from the command.
This code isn't actually removing the label, it just briefly changes the behaviour of thelabel
command to null. If I were to print the argument ofremovelabel
as if it was a string, I'd still seelabel{some_label}
.
– noibe
Feb 17 at 22:53
if you expand the argument of removelabel... it will not be there... If you want an argument of a command to be something and without even expanding it to disappear ane part of it... I am afraid it can't be done...
– koleygr
Feb 18 at 0:37
1
I suggestdefmyEmptyLabel#1{@bsphack@esphack}
.
– Ulrich Diez
Feb 18 at 21:55
@UlrichDiez.... you may write an answer because I don't really know what is these commands...
– koleygr
Feb 19 at 10:56
1
@koleygrlabel
shall not deliver visible things into the output-file/pdf-file.@bsphack
/@esphack
ensures that a space-token behind the argument of alabel
-command does not produce undesired visible whitespace in case there already was a space before thelabel
-command... Many of these commands are explained in source2e.pdf
– Ulrich Diez
Feb 19 at 13:44
|
show 1 more comment
This is something I suppose could work for you:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabel#1letlabeloldlabel} % some code
begin{document}
begin{minipage}{textwidth}
removelabel{captionof{figure}{label{some_label} This label should be removed}} % output: 'This label should be removed'
end{minipage}
removelabel{This string is already label-less} % output: 'This string is already label-less
Figure~ref{some_label}
end{document}
In the output the label is not defined and returns questionmarks
Edit:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabelxdefremovedlabel{#1}letlabeloldlabel} % some code
begin{document}
removelabel{label{some_label} This label should be removed}
removedlabel
removelabel{This string is already label-less} % output: 'This string is already label-less
removedlabel
%Figure~ref{some_label}
end{document}
Now removedlabel
gives the string without the label... But I am not sure what you want to do... May be you should be more clear on what you expect from the command.
This is something I suppose could work for you:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabel#1letlabeloldlabel} % some code
begin{document}
begin{minipage}{textwidth}
removelabel{captionof{figure}{label{some_label} This label should be removed}} % output: 'This label should be removed'
end{minipage}
removelabel{This string is already label-less} % output: 'This string is already label-less
Figure~ref{some_label}
end{document}
In the output the label is not defined and returns questionmarks
Edit:
documentclass{article}
usepackage{caption}
usepackage{hyperref}
defmyEmptyLabel#1{}
newcommand{removelabel}[1]{letoldlabellabelletlabelmyEmptyLabelxdefremovedlabel{#1}letlabeloldlabel} % some code
begin{document}
removelabel{label{some_label} This label should be removed}
removedlabel
removelabel{This string is already label-less} % output: 'This string is already label-less
removedlabel
%Figure~ref{some_label}
end{document}
Now removedlabel
gives the string without the label... But I am not sure what you want to do... May be you should be more clear on what you expect from the command.
edited Feb 18 at 0:46
answered Feb 17 at 15:34
koleygrkoleygr
13k11038
13k11038
This code isn't actually removing the label, it just briefly changes the behaviour of thelabel
command to null. If I were to print the argument ofremovelabel
as if it was a string, I'd still seelabel{some_label}
.
– noibe
Feb 17 at 22:53
if you expand the argument of removelabel... it will not be there... If you want an argument of a command to be something and without even expanding it to disappear ane part of it... I am afraid it can't be done...
– koleygr
Feb 18 at 0:37
1
I suggestdefmyEmptyLabel#1{@bsphack@esphack}
.
– Ulrich Diez
Feb 18 at 21:55
@UlrichDiez.... you may write an answer because I don't really know what is these commands...
– koleygr
Feb 19 at 10:56
1
@koleygrlabel
shall not deliver visible things into the output-file/pdf-file.@bsphack
/@esphack
ensures that a space-token behind the argument of alabel
-command does not produce undesired visible whitespace in case there already was a space before thelabel
-command... Many of these commands are explained in source2e.pdf
– Ulrich Diez
Feb 19 at 13:44
|
show 1 more comment
This code isn't actually removing the label, it just briefly changes the behaviour of thelabel
command to null. If I were to print the argument ofremovelabel
as if it was a string, I'd still seelabel{some_label}
.
– noibe
Feb 17 at 22:53
if you expand the argument of removelabel... it will not be there... If you want an argument of a command to be something and without even expanding it to disappear ane part of it... I am afraid it can't be done...
– koleygr
Feb 18 at 0:37
1
I suggestdefmyEmptyLabel#1{@bsphack@esphack}
.
– Ulrich Diez
Feb 18 at 21:55
@UlrichDiez.... you may write an answer because I don't really know what is these commands...
– koleygr
Feb 19 at 10:56
1
@koleygrlabel
shall not deliver visible things into the output-file/pdf-file.@bsphack
/@esphack
ensures that a space-token behind the argument of alabel
-command does not produce undesired visible whitespace in case there already was a space before thelabel
-command... Many of these commands are explained in source2e.pdf
– Ulrich Diez
Feb 19 at 13:44
This code isn't actually removing the label, it just briefly changes the behaviour of the
label
command to null. If I were to print the argument of removelabel
as if it was a string, I'd still see label{some_label}
.– noibe
Feb 17 at 22:53
This code isn't actually removing the label, it just briefly changes the behaviour of the
label
command to null. If I were to print the argument of removelabel
as if it was a string, I'd still see label{some_label}
.– noibe
Feb 17 at 22:53
if you expand the argument of removelabel... it will not be there... If you want an argument of a command to be something and without even expanding it to disappear ane part of it... I am afraid it can't be done...
– koleygr
Feb 18 at 0:37
if you expand the argument of removelabel... it will not be there... If you want an argument of a command to be something and without even expanding it to disappear ane part of it... I am afraid it can't be done...
– koleygr
Feb 18 at 0:37
1
1
I suggest
defmyEmptyLabel#1{@bsphack@esphack}
.– Ulrich Diez
Feb 18 at 21:55
I suggest
defmyEmptyLabel#1{@bsphack@esphack}
.– Ulrich Diez
Feb 18 at 21:55
@UlrichDiez.... you may write an answer because I don't really know what is these commands...
– koleygr
Feb 19 at 10:56
@UlrichDiez.... you may write an answer because I don't really know what is these commands...
– koleygr
Feb 19 at 10:56
1
1
@koleygr
label
shall not deliver visible things into the output-file/pdf-file. @bsphack
/@esphack
ensures that a space-token behind the argument of a label
-command does not produce undesired visible whitespace in case there already was a space before the label
-command... Many of these commands are explained in source2e.pdf– Ulrich Diez
Feb 19 at 13:44
@koleygr
label
shall not deliver visible things into the output-file/pdf-file. @bsphack
/@esphack
ensures that a space-token behind the argument of a label
-command does not produce undesired visible whitespace in case there already was a space before the label
-command... Many of these commands are explained in source2e.pdf– Ulrich Diez
Feb 19 at 13:44
|
show 1 more comment
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475268%2fremoving-label-from-a-string%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
May I ask why you need such a command? What should a leading label do?
– Kurt
Feb 17 at 2:06
see this for the full story. I'm trying to fix the bug shown in the code posted after 'EDIT: MWE showing the problem'. I'd call such a function on line 52, with
BODY
as its argument.– noibe
Feb 17 at 2:45
is a lualatex solution acceptable?
– JPi
Feb 17 at 3:27
@JPi not really
– noibe
Feb 17 at 11:00
Then I can't tell you. 😣
– JPi
Feb 17 at 12:24