Cleveref and pdf Bookmark












6














I'm making pdf bookmarks with hyperref and cleveref packages. However, the pdf bookmarks show the label I defined, rather than the theorem name the label refers to. Here's the code:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some label}
This is a theorem.
end{theorem}

section{Proof to Cref{some label}}

end{document}


And here's the pdf:
enter image description here



Any idea how to change the label to "Proof to Theorem 1" instead of "Proof to some label"?










share|improve this question
























  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – karlkoeller
    Mar 28 '15 at 6:40










  • Cref is not really expandable, I fear, since it's defined to be a robust command
    – Christian Hupfer
    Mar 28 '15 at 6:47


















6














I'm making pdf bookmarks with hyperref and cleveref packages. However, the pdf bookmarks show the label I defined, rather than the theorem name the label refers to. Here's the code:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some label}
This is a theorem.
end{theorem}

section{Proof to Cref{some label}}

end{document}


And here's the pdf:
enter image description here



Any idea how to change the label to "Proof to Theorem 1" instead of "Proof to some label"?










share|improve this question
























  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – karlkoeller
    Mar 28 '15 at 6:40










  • Cref is not really expandable, I fear, since it's defined to be a robust command
    – Christian Hupfer
    Mar 28 '15 at 6:47
















6












6








6


0





I'm making pdf bookmarks with hyperref and cleveref packages. However, the pdf bookmarks show the label I defined, rather than the theorem name the label refers to. Here's the code:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some label}
This is a theorem.
end{theorem}

section{Proof to Cref{some label}}

end{document}


And here's the pdf:
enter image description here



Any idea how to change the label to "Proof to Theorem 1" instead of "Proof to some label"?










share|improve this question















I'm making pdf bookmarks with hyperref and cleveref packages. However, the pdf bookmarks show the label I defined, rather than the theorem name the label refers to. Here's the code:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some label}
This is a theorem.
end{theorem}

section{Proof to Cref{some label}}

end{document}


And here's the pdf:
enter image description here



Any idea how to change the label to "Proof to Theorem 1" instead of "Proof to some label"?







hyperref pdf cleveref bookmarks






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 '15 at 20:17







Erika L

















asked Mar 28 '15 at 6:26









Erika LErika L

504




504












  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – karlkoeller
    Mar 28 '15 at 6:40










  • Cref is not really expandable, I fear, since it's defined to be a robust command
    – Christian Hupfer
    Mar 28 '15 at 6:47




















  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – karlkoeller
    Mar 28 '15 at 6:40










  • Cref is not really expandable, I fear, since it's defined to be a robust command
    – Christian Hupfer
    Mar 28 '15 at 6:47


















Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– karlkoeller
Mar 28 '15 at 6:40




Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– karlkoeller
Mar 28 '15 at 6:40












Cref is not really expandable, I fear, since it's defined to be a robust command
– Christian Hupfer
Mar 28 '15 at 6:47






Cref is not really expandable, I fear, since it's defined to be a robust command
– Christian Hupfer
Mar 28 '15 at 6:47












2 Answers
2






active

oldest

votes


















7














I'm afraid there is no solution for this, apart from using the command texorpdfstring, that is you have to specify what has to go in the text and what has to go in the bookmarks.



Hence, substitute



section{Proof to Cref{some label}}


with



section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}


Note that it isn't a good idea to have label names with spaces, so I've substituted some label with some_label.



MWE:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}

end{document}


Output:



enter image description here






share|improve this answer























  • That solves the problem (with a bit more work), thank you!
    – Erika L
    Mar 28 '15 at 16:01



















3














The Cref command cannot be used in section when bookmarks are being produced; however, autoref works (it's less powerful, though). For a simple application like this you can do as follows:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

pdfstringdefDisableCommands{letCrefautoref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}

begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to Cref{some_label}}

end{document}


enter image description here






share|improve this answer





















  • Thanks. I did try autoref, but I do have a bunch of lemmas/propositions/corollaries which makes cleveref more suitable.
    – Erika L
    Mar 28 '15 at 20:43












  • @ErikaL Yes, but as you see, I let Cref to autoref only in bookmarks where super precision is not really necessary.
    – egreg
    Mar 28 '15 at 20:44












  • It does work for the MWE. However I found another strange behavior using this method, see [tex.stackexchange.com/questions/235634/…
    – Erika L
    Mar 28 '15 at 21:12










  • This answer deserves to be upvoted more. It is an automatic solution relative to the manual solution that the accepted answer proposes. The virtues are obvious. If a figure number being referred to in the bookmark/section heading changes, then hand-coding a string quickly becomes dangerously out of date & misleading.
    – Krishna
    6 hours ago











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f235516%2fcleveref-and-pdf-bookmark%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














I'm afraid there is no solution for this, apart from using the command texorpdfstring, that is you have to specify what has to go in the text and what has to go in the bookmarks.



Hence, substitute



section{Proof to Cref{some label}}


with



section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}


Note that it isn't a good idea to have label names with spaces, so I've substituted some label with some_label.



MWE:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}

end{document}


Output:



enter image description here






share|improve this answer























  • That solves the problem (with a bit more work), thank you!
    – Erika L
    Mar 28 '15 at 16:01
















7














I'm afraid there is no solution for this, apart from using the command texorpdfstring, that is you have to specify what has to go in the text and what has to go in the bookmarks.



Hence, substitute



section{Proof to Cref{some label}}


with



section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}


Note that it isn't a good idea to have label names with spaces, so I've substituted some label with some_label.



MWE:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}

end{document}


Output:



enter image description here






share|improve this answer























  • That solves the problem (with a bit more work), thank you!
    – Erika L
    Mar 28 '15 at 16:01














7












7








7






I'm afraid there is no solution for this, apart from using the command texorpdfstring, that is you have to specify what has to go in the text and what has to go in the bookmarks.



Hence, substitute



section{Proof to Cref{some label}}


with



section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}


Note that it isn't a good idea to have label names with spaces, so I've substituted some label with some_label.



MWE:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}

end{document}


Output:



enter image description here






share|improve this answer














I'm afraid there is no solution for this, apart from using the command texorpdfstring, that is you have to specify what has to go in the text and what has to go in the bookmarks.



Hence, substitute



section{Proof to Cref{some label}}


with



section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}


Note that it isn't a good idea to have label names with spaces, so I've substituted some label with some_label.



MWE:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}
begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to texorpdfstring{Cref{some_label}}{Theorem ref{some_label}}}

end{document}


Output:



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 28 '15 at 6:55

























answered Mar 28 '15 at 6:47









karlkoellerkarlkoeller

106k9193356




106k9193356












  • That solves the problem (with a bit more work), thank you!
    – Erika L
    Mar 28 '15 at 16:01


















  • That solves the problem (with a bit more work), thank you!
    – Erika L
    Mar 28 '15 at 16:01
















That solves the problem (with a bit more work), thank you!
– Erika L
Mar 28 '15 at 16:01




That solves the problem (with a bit more work), thank you!
– Erika L
Mar 28 '15 at 16:01











3














The Cref command cannot be used in section when bookmarks are being produced; however, autoref works (it's less powerful, though). For a simple application like this you can do as follows:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

pdfstringdefDisableCommands{letCrefautoref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}

begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to Cref{some_label}}

end{document}


enter image description here






share|improve this answer





















  • Thanks. I did try autoref, but I do have a bunch of lemmas/propositions/corollaries which makes cleveref more suitable.
    – Erika L
    Mar 28 '15 at 20:43












  • @ErikaL Yes, but as you see, I let Cref to autoref only in bookmarks where super precision is not really necessary.
    – egreg
    Mar 28 '15 at 20:44












  • It does work for the MWE. However I found another strange behavior using this method, see [tex.stackexchange.com/questions/235634/…
    – Erika L
    Mar 28 '15 at 21:12










  • This answer deserves to be upvoted more. It is an automatic solution relative to the manual solution that the accepted answer proposes. The virtues are obvious. If a figure number being referred to in the bookmark/section heading changes, then hand-coding a string quickly becomes dangerously out of date & misleading.
    – Krishna
    6 hours ago
















3














The Cref command cannot be used in section when bookmarks are being produced; however, autoref works (it's less powerful, though). For a simple application like this you can do as follows:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

pdfstringdefDisableCommands{letCrefautoref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}

begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to Cref{some_label}}

end{document}


enter image description here






share|improve this answer





















  • Thanks. I did try autoref, but I do have a bunch of lemmas/propositions/corollaries which makes cleveref more suitable.
    – Erika L
    Mar 28 '15 at 20:43












  • @ErikaL Yes, but as you see, I let Cref to autoref only in bookmarks where super precision is not really necessary.
    – egreg
    Mar 28 '15 at 20:44












  • It does work for the MWE. However I found another strange behavior using this method, see [tex.stackexchange.com/questions/235634/…
    – Erika L
    Mar 28 '15 at 21:12










  • This answer deserves to be upvoted more. It is an automatic solution relative to the manual solution that the accepted answer proposes. The virtues are obvious. If a figure number being referred to in the bookmark/section heading changes, then hand-coding a string quickly becomes dangerously out of date & misleading.
    – Krishna
    6 hours ago














3












3








3






The Cref command cannot be used in section when bookmarks are being produced; however, autoref works (it's less powerful, though). For a simple application like this you can do as follows:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

pdfstringdefDisableCommands{letCrefautoref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}

begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to Cref{some_label}}

end{document}


enter image description here






share|improve this answer












The Cref command cannot be used in section when bookmarks are being produced; however, autoref works (it's less powerful, though). For a simple application like this you can do as follows:



documentclass{article}

usepackage{hyperref}
usepackage{cleveref}

pdfstringdefDisableCommands{letCrefautoref}

newtheorem{theorem}{Theorem}

begin{document}

section{Section 1}

begin{theorem}label{some_label}
This is a theorem.
end{theorem}

section{Proof to Cref{some_label}}

end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 '15 at 20:34









egregegreg

710k8618893173




710k8618893173












  • Thanks. I did try autoref, but I do have a bunch of lemmas/propositions/corollaries which makes cleveref more suitable.
    – Erika L
    Mar 28 '15 at 20:43












  • @ErikaL Yes, but as you see, I let Cref to autoref only in bookmarks where super precision is not really necessary.
    – egreg
    Mar 28 '15 at 20:44












  • It does work for the MWE. However I found another strange behavior using this method, see [tex.stackexchange.com/questions/235634/…
    – Erika L
    Mar 28 '15 at 21:12










  • This answer deserves to be upvoted more. It is an automatic solution relative to the manual solution that the accepted answer proposes. The virtues are obvious. If a figure number being referred to in the bookmark/section heading changes, then hand-coding a string quickly becomes dangerously out of date & misleading.
    – Krishna
    6 hours ago


















  • Thanks. I did try autoref, but I do have a bunch of lemmas/propositions/corollaries which makes cleveref more suitable.
    – Erika L
    Mar 28 '15 at 20:43












  • @ErikaL Yes, but as you see, I let Cref to autoref only in bookmarks where super precision is not really necessary.
    – egreg
    Mar 28 '15 at 20:44












  • It does work for the MWE. However I found another strange behavior using this method, see [tex.stackexchange.com/questions/235634/…
    – Erika L
    Mar 28 '15 at 21:12










  • This answer deserves to be upvoted more. It is an automatic solution relative to the manual solution that the accepted answer proposes. The virtues are obvious. If a figure number being referred to in the bookmark/section heading changes, then hand-coding a string quickly becomes dangerously out of date & misleading.
    – Krishna
    6 hours ago
















Thanks. I did try autoref, but I do have a bunch of lemmas/propositions/corollaries which makes cleveref more suitable.
– Erika L
Mar 28 '15 at 20:43






Thanks. I did try autoref, but I do have a bunch of lemmas/propositions/corollaries which makes cleveref more suitable.
– Erika L
Mar 28 '15 at 20:43














@ErikaL Yes, but as you see, I let Cref to autoref only in bookmarks where super precision is not really necessary.
– egreg
Mar 28 '15 at 20:44






@ErikaL Yes, but as you see, I let Cref to autoref only in bookmarks where super precision is not really necessary.
– egreg
Mar 28 '15 at 20:44














It does work for the MWE. However I found another strange behavior using this method, see [tex.stackexchange.com/questions/235634/…
– Erika L
Mar 28 '15 at 21:12




It does work for the MWE. However I found another strange behavior using this method, see [tex.stackexchange.com/questions/235634/…
– Erika L
Mar 28 '15 at 21:12












This answer deserves to be upvoted more. It is an automatic solution relative to the manual solution that the accepted answer proposes. The virtues are obvious. If a figure number being referred to in the bookmark/section heading changes, then hand-coding a string quickly becomes dangerously out of date & misleading.
– Krishna
6 hours ago




This answer deserves to be upvoted more. It is an automatic solution relative to the manual solution that the accepted answer proposes. The virtues are obvious. If a figure number being referred to in the bookmark/section heading changes, then hand-coding a string quickly becomes dangerously out of date & misleading.
– Krishna
6 hours ago


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f235516%2fcleveref-and-pdf-bookmark%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks