hyperref warns when using cleveref in sectionObtain expansion of crefAmsbook: Theoremstyles definition and remark identical?Hyperlinking problems when using subequations, hyperref and cleverefHow to reference chapter/section title when using cleverefhow to correctly customize section and equation using cleverefCleveref messes up theoremstylesHow to cross-reference an unnumbered theorem using hyperref and cleverefCryptic error message when using cleveref and hyperref with subequationsUltimate proof at the end/in appendix: different sections, with references to proof/theorem, restate, and synctex
How can I say "I want to" as a short response, omitting the main verb?
Are there objective criteria for classifying consonance v. dissonance?
In what state are satellites left in when they are left in a graveyard orbit?
Bash awk command with quotes
Why is belonging not transitive?
Permutations in Disguise
Exam design: give maximum score per question or not?
Impossible Scrabble Words
If I want an interpretable model, are there methods other than Linear Regression?
Importance of the current postdoc advisor's letter in TT job search
How To Make Earth's Oceans as Brackish as Lyr's
How do certain apps show new notifications when internet access is restricted to them?
'Overwrote' files, space still occupied, are they lost?
How to draw a Venn diagram for X - (Y intersect Z)?
What is a "major country" as named in Bernie Sanders' Healthcare debate answers?
Work done by spring force
Why is it called a stateful and a stateless firewall?
Pronunciation of "солнце"
Does a large scratch in an ND filter affect image quality?
How do we know that black holes are spinning?
Ethernet, Wifi and a little human psychology
Test to know when to use GLM over Linear Regression?
A command to output each line forward then backwards
How would you control supersoldiers in a late iron-age society?
hyperref warns when using cleveref in section
Obtain expansion of crefAmsbook: Theoremstyles definition and remark identical?Hyperlinking problems when using subequations, hyperref and cleverefHow to reference chapter/section title when using cleverefhow to correctly customize section and equation using cleverefCleveref messes up theoremstylesHow to cross-reference an unnumbered theorem using hyperref and cleverefCryptic error message when using cleveref and hyperref with subequationsUltimate proof at the end/in appendix: different sections, with references to proof/theorem, restate, and synctex
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I encounter a small but annoying problem with the following MWE
documentclassarticle
usepackagehyperref,cleveref
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good
endthm
sectionProof of Crefgood
It is trivial.
enddocument
The compiler (pdflatex) complains
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `@ifnextchar' on input line 13.
Also the PDF TOC shows Proof of good
instead of Proof Theorem 1
.
Is their any solution other than saying sectionProof of Theorem ref...
?
After all, the whole point of using cleveref
is not to repeat the fact that good
is a theorem.
PS1. I also want a solution for amsart
or more general document classes.
(That is, the order of usepackage
s is more or less fixed)
PS2. Feel free to mark duplicate.
Although other MWEs I saw on this site are far from minimal.
theorems cleveref
add a comment
|
I encounter a small but annoying problem with the following MWE
documentclassarticle
usepackagehyperref,cleveref
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good
endthm
sectionProof of Crefgood
It is trivial.
enddocument
The compiler (pdflatex) complains
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `@ifnextchar' on input line 13.
Also the PDF TOC shows Proof of good
instead of Proof Theorem 1
.
Is their any solution other than saying sectionProof of Theorem ref...
?
After all, the whole point of using cleveref
is not to repeat the fact that good
is a theorem.
PS1. I also want a solution for amsart
or more general document classes.
(That is, the order of usepackage
s is more or less fixed)
PS2. Feel free to mark duplicate.
Although other MWEs I saw on this site are far from minimal.
theorems cleveref
2
The issue is thatcleveref
's machinery is not expandable (@ifnextchar
, for example, isn't), so it can't be turned into a PDF string. Thecrossreftools
package provides an expandable alternative. Possible duplicate? tex.stackexchange.com/q/381513/134574
– Phelype Oleinik
8 hours ago
@PhelypeOleinik I got an error complainingUse of refstepcounter@optarg doesn't match its definition
when I usecrtCref
.
– Symbol 1
8 hours ago
Indeed, after leaving the comment I went to try my suggestion (I should probably try and then comment :-). This problem is becausecleveref
inserts some non-expandableMakeUppercase
in the reference to the theorem, and whencrossreftools
tries to use it in an expansion-only context, hell breaks loose. I'll investigate :-)
– Phelype Oleinik
8 hours ago
add a comment
|
I encounter a small but annoying problem with the following MWE
documentclassarticle
usepackagehyperref,cleveref
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good
endthm
sectionProof of Crefgood
It is trivial.
enddocument
The compiler (pdflatex) complains
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `@ifnextchar' on input line 13.
Also the PDF TOC shows Proof of good
instead of Proof Theorem 1
.
Is their any solution other than saying sectionProof of Theorem ref...
?
After all, the whole point of using cleveref
is not to repeat the fact that good
is a theorem.
PS1. I also want a solution for amsart
or more general document classes.
(That is, the order of usepackage
s is more or less fixed)
PS2. Feel free to mark duplicate.
Although other MWEs I saw on this site are far from minimal.
theorems cleveref
I encounter a small but annoying problem with the following MWE
documentclassarticle
usepackagehyperref,cleveref
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good
endthm
sectionProof of Crefgood
It is trivial.
enddocument
The compiler (pdflatex) complains
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `@ifnextchar' on input line 13.
Also the PDF TOC shows Proof of good
instead of Proof Theorem 1
.
Is their any solution other than saying sectionProof of Theorem ref...
?
After all, the whole point of using cleveref
is not to repeat the fact that good
is a theorem.
PS1. I also want a solution for amsart
or more general document classes.
(That is, the order of usepackage
s is more or less fixed)
PS2. Feel free to mark duplicate.
Although other MWEs I saw on this site are far from minimal.
theorems cleveref
theorems cleveref
asked 8 hours ago
Symbol 1Symbol 1
26.8k2 gold badges44 silver badges128 bronze badges
26.8k2 gold badges44 silver badges128 bronze badges
2
The issue is thatcleveref
's machinery is not expandable (@ifnextchar
, for example, isn't), so it can't be turned into a PDF string. Thecrossreftools
package provides an expandable alternative. Possible duplicate? tex.stackexchange.com/q/381513/134574
– Phelype Oleinik
8 hours ago
@PhelypeOleinik I got an error complainingUse of refstepcounter@optarg doesn't match its definition
when I usecrtCref
.
– Symbol 1
8 hours ago
Indeed, after leaving the comment I went to try my suggestion (I should probably try and then comment :-). This problem is becausecleveref
inserts some non-expandableMakeUppercase
in the reference to the theorem, and whencrossreftools
tries to use it in an expansion-only context, hell breaks loose. I'll investigate :-)
– Phelype Oleinik
8 hours ago
add a comment
|
2
The issue is thatcleveref
's machinery is not expandable (@ifnextchar
, for example, isn't), so it can't be turned into a PDF string. Thecrossreftools
package provides an expandable alternative. Possible duplicate? tex.stackexchange.com/q/381513/134574
– Phelype Oleinik
8 hours ago
@PhelypeOleinik I got an error complainingUse of refstepcounter@optarg doesn't match its definition
when I usecrtCref
.
– Symbol 1
8 hours ago
Indeed, after leaving the comment I went to try my suggestion (I should probably try and then comment :-). This problem is becausecleveref
inserts some non-expandableMakeUppercase
in the reference to the theorem, and whencrossreftools
tries to use it in an expansion-only context, hell breaks loose. I'll investigate :-)
– Phelype Oleinik
8 hours ago
2
2
The issue is that
cleveref
's machinery is not expandable (@ifnextchar
, for example, isn't), so it can't be turned into a PDF string. The crossreftools
package provides an expandable alternative. Possible duplicate? tex.stackexchange.com/q/381513/134574– Phelype Oleinik
8 hours ago
The issue is that
cleveref
's machinery is not expandable (@ifnextchar
, for example, isn't), so it can't be turned into a PDF string. The crossreftools
package provides an expandable alternative. Possible duplicate? tex.stackexchange.com/q/381513/134574– Phelype Oleinik
8 hours ago
@PhelypeOleinik I got an error complaining
Use of refstepcounter@optarg doesn't match its definition
when I use crtCref
.– Symbol 1
8 hours ago
@PhelypeOleinik I got an error complaining
Use of refstepcounter@optarg doesn't match its definition
when I use crtCref
.– Symbol 1
8 hours ago
Indeed, after leaving the comment I went to try my suggestion (I should probably try and then comment :-). This problem is because
cleveref
inserts some non-expandable MakeUppercase
in the reference to the theorem, and when crossreftools
tries to use it in an expansion-only context, hell breaks loose. I'll investigate :-)– Phelype Oleinik
8 hours ago
Indeed, after leaving the comment I went to try my suggestion (I should probably try and then comment :-). This problem is because
cleveref
inserts some non-expandable MakeUppercase
in the reference to the theorem, and when crossreftools
tries to use it in an expansion-only context, hell breaks loose. I'll investigate :-)– Phelype Oleinik
8 hours ago
add a comment
|
1 Answer
1
active
oldest
votes
As I said in the comment, the issue is that cleveref
's machinery is not expandable (the @ifnextchar
that hyperref
complains about, for example, isn't expandable), so it can't be turned into a PDF string.
The crossreftools
package provides an expandable alternative for cross referencing commands. For cleverref
you can replace cref
by crtcref
and Cref
by crtCref
.
However, as you noted in your comment, only using that breaks badly. The reason is that cleverref
redefines some internals of the theorems and inserts some MakeUppercase
and MakeLowercase
(which aren't expandable). The issue boils down to the fact that these commands end up in the cross reference code, which is expected to contain only text. When hyperref
tries to expand that, chaos ensues.
I tried to find a proper fix, but most of them led to a can of worms of code which would then be incompatible with everything. An easier way out, which preserves cleveref
's functionality and leaves the cross reference text expandable, is to use expl3
's case changing functions. I used etoolbox
's patchcmd
to replace the two occurrences of MakeUppercase
and one of MakeLowercase
by tl_upper_case:n
and tl_upper_case:n
, respectively, from the commands @othm
, @xnthm
, and @ynthm
. After patching that, the expandability problem is no more :-)
The pdf:
and the pdf bookmark file:
BOOKMARK [1][-]section.1Proof of Theorem 1% 1
Code:
documentclassarticle
usepackageexpl3,etoolbox
usepackagehyperref,cleveref
usepackagecrossreftools
% This patch must be after loading cleverref and before defining a new theorem
ExplSyntaxOn
makeatletter
clist_map_inline:nn @othm, @xnthm, @ynthm
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeLowercase tl_lower_case:n FAILED:
makeatother
ExplSyntaxOff
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good. expl3 is awesome :D
endthm
sectionProof of crtCrefgood
It is trivial.
enddocument
add a 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/4.0/"u003ecc by-sa 4.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%2f508319%2fhyperref-warns-when-using-cleveref-in-section%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
As I said in the comment, the issue is that cleveref
's machinery is not expandable (the @ifnextchar
that hyperref
complains about, for example, isn't expandable), so it can't be turned into a PDF string.
The crossreftools
package provides an expandable alternative for cross referencing commands. For cleverref
you can replace cref
by crtcref
and Cref
by crtCref
.
However, as you noted in your comment, only using that breaks badly. The reason is that cleverref
redefines some internals of the theorems and inserts some MakeUppercase
and MakeLowercase
(which aren't expandable). The issue boils down to the fact that these commands end up in the cross reference code, which is expected to contain only text. When hyperref
tries to expand that, chaos ensues.
I tried to find a proper fix, but most of them led to a can of worms of code which would then be incompatible with everything. An easier way out, which preserves cleveref
's functionality and leaves the cross reference text expandable, is to use expl3
's case changing functions. I used etoolbox
's patchcmd
to replace the two occurrences of MakeUppercase
and one of MakeLowercase
by tl_upper_case:n
and tl_upper_case:n
, respectively, from the commands @othm
, @xnthm
, and @ynthm
. After patching that, the expandability problem is no more :-)
The pdf:
and the pdf bookmark file:
BOOKMARK [1][-]section.1Proof of Theorem 1% 1
Code:
documentclassarticle
usepackageexpl3,etoolbox
usepackagehyperref,cleveref
usepackagecrossreftools
% This patch must be after loading cleverref and before defining a new theorem
ExplSyntaxOn
makeatletter
clist_map_inline:nn @othm, @xnthm, @ynthm
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeLowercase tl_lower_case:n FAILED:
makeatother
ExplSyntaxOff
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good. expl3 is awesome :D
endthm
sectionProof of crtCrefgood
It is trivial.
enddocument
add a comment
|
As I said in the comment, the issue is that cleveref
's machinery is not expandable (the @ifnextchar
that hyperref
complains about, for example, isn't expandable), so it can't be turned into a PDF string.
The crossreftools
package provides an expandable alternative for cross referencing commands. For cleverref
you can replace cref
by crtcref
and Cref
by crtCref
.
However, as you noted in your comment, only using that breaks badly. The reason is that cleverref
redefines some internals of the theorems and inserts some MakeUppercase
and MakeLowercase
(which aren't expandable). The issue boils down to the fact that these commands end up in the cross reference code, which is expected to contain only text. When hyperref
tries to expand that, chaos ensues.
I tried to find a proper fix, but most of them led to a can of worms of code which would then be incompatible with everything. An easier way out, which preserves cleveref
's functionality and leaves the cross reference text expandable, is to use expl3
's case changing functions. I used etoolbox
's patchcmd
to replace the two occurrences of MakeUppercase
and one of MakeLowercase
by tl_upper_case:n
and tl_upper_case:n
, respectively, from the commands @othm
, @xnthm
, and @ynthm
. After patching that, the expandability problem is no more :-)
The pdf:
and the pdf bookmark file:
BOOKMARK [1][-]section.1Proof of Theorem 1% 1
Code:
documentclassarticle
usepackageexpl3,etoolbox
usepackagehyperref,cleveref
usepackagecrossreftools
% This patch must be after loading cleverref and before defining a new theorem
ExplSyntaxOn
makeatletter
clist_map_inline:nn @othm, @xnthm, @ynthm
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeLowercase tl_lower_case:n FAILED:
makeatother
ExplSyntaxOff
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good. expl3 is awesome :D
endthm
sectionProof of crtCrefgood
It is trivial.
enddocument
add a comment
|
As I said in the comment, the issue is that cleveref
's machinery is not expandable (the @ifnextchar
that hyperref
complains about, for example, isn't expandable), so it can't be turned into a PDF string.
The crossreftools
package provides an expandable alternative for cross referencing commands. For cleverref
you can replace cref
by crtcref
and Cref
by crtCref
.
However, as you noted in your comment, only using that breaks badly. The reason is that cleverref
redefines some internals of the theorems and inserts some MakeUppercase
and MakeLowercase
(which aren't expandable). The issue boils down to the fact that these commands end up in the cross reference code, which is expected to contain only text. When hyperref
tries to expand that, chaos ensues.
I tried to find a proper fix, but most of them led to a can of worms of code which would then be incompatible with everything. An easier way out, which preserves cleveref
's functionality and leaves the cross reference text expandable, is to use expl3
's case changing functions. I used etoolbox
's patchcmd
to replace the two occurrences of MakeUppercase
and one of MakeLowercase
by tl_upper_case:n
and tl_upper_case:n
, respectively, from the commands @othm
, @xnthm
, and @ynthm
. After patching that, the expandability problem is no more :-)
The pdf:
and the pdf bookmark file:
BOOKMARK [1][-]section.1Proof of Theorem 1% 1
Code:
documentclassarticle
usepackageexpl3,etoolbox
usepackagehyperref,cleveref
usepackagecrossreftools
% This patch must be after loading cleverref and before defining a new theorem
ExplSyntaxOn
makeatletter
clist_map_inline:nn @othm, @xnthm, @ynthm
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeLowercase tl_lower_case:n FAILED:
makeatother
ExplSyntaxOff
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good. expl3 is awesome :D
endthm
sectionProof of crtCrefgood
It is trivial.
enddocument
As I said in the comment, the issue is that cleveref
's machinery is not expandable (the @ifnextchar
that hyperref
complains about, for example, isn't expandable), so it can't be turned into a PDF string.
The crossreftools
package provides an expandable alternative for cross referencing commands. For cleverref
you can replace cref
by crtcref
and Cref
by crtCref
.
However, as you noted in your comment, only using that breaks badly. The reason is that cleverref
redefines some internals of the theorems and inserts some MakeUppercase
and MakeLowercase
(which aren't expandable). The issue boils down to the fact that these commands end up in the cross reference code, which is expected to contain only text. When hyperref
tries to expand that, chaos ensues.
I tried to find a proper fix, but most of them led to a can of worms of code which would then be incompatible with everything. An easier way out, which preserves cleveref
's functionality and leaves the cross reference text expandable, is to use expl3
's case changing functions. I used etoolbox
's patchcmd
to replace the two occurrences of MakeUppercase
and one of MakeLowercase
by tl_upper_case:n
and tl_upper_case:n
, respectively, from the commands @othm
, @xnthm
, and @ynthm
. After patching that, the expandability problem is no more :-)
The pdf:
and the pdf bookmark file:
BOOKMARK [1][-]section.1Proof of Theorem 1% 1
Code:
documentclassarticle
usepackageexpl3,etoolbox
usepackagehyperref,cleveref
usepackagecrossreftools
% This patch must be after loading cleverref and before defining a new theorem
ExplSyntaxOn
makeatletter
clist_map_inline:nn @othm, @xnthm, @ynthm
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeUppercase tl_upper_case:n FAILED:
patchcmd #1 MakeLowercase tl_lower_case:n FAILED:
makeatother
ExplSyntaxOff
newtheoremthmTheorem
begindocument
beginthmlabelgood
Cleveref is good. expl3 is awesome :D
endthm
sectionProof of crtCrefgood
It is trivial.
enddocument
answered 7 hours ago
Phelype OleinikPhelype Oleinik
33.9k7 gold badges57 silver badges113 bronze badges
33.9k7 gold badges57 silver badges113 bronze badges
add a comment
|
add a 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%2f508319%2fhyperref-warns-when-using-cleveref-in-section%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
2
The issue is that
cleveref
's machinery is not expandable (@ifnextchar
, for example, isn't), so it can't be turned into a PDF string. Thecrossreftools
package provides an expandable alternative. Possible duplicate? tex.stackexchange.com/q/381513/134574– Phelype Oleinik
8 hours ago
@PhelypeOleinik I got an error complaining
Use of refstepcounter@optarg doesn't match its definition
when I usecrtCref
.– Symbol 1
8 hours ago
Indeed, after leaving the comment I went to try my suggestion (I should probably try and then comment :-). This problem is because
cleveref
inserts some non-expandableMakeUppercase
in the reference to the theorem, and whencrossreftools
tries to use it in an expansion-only context, hell breaks loose. I'll investigate :-)– Phelype Oleinik
8 hours ago