Cyrilic characters in label and ref in pdflatex











up vote
6
down vote

favorite












I want to write label and ref with Cyrillic(Russian) characters in pdflatex. usepackage[russian]{babel} in preamble.



I tried label{detokenize{}}, but it doesn't work.



documentclass[a4paper,12pt]{article} 
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{Ссылка_на_раздел}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}









share|improve this question




















  • 1




    Welcome to TeX.SX! Could you please add a complete but minimal example document with your attempts?
    – siracusa
    Dec 7 at 7:04






  • 2




    With pdfLaTeX I would only use safe ASCII characters in labels. Sometimes certain non-ASCII characters may work by accident, but that is not at all guaranteed (e.g. section{Ä}label{ä}ref{ä} works for me, but section{ß}label{ß}ref{ß} fails spectacularly). If you want non-ASCII labels you need to use a full Unicode engine such as XeLaTeX or LuaLaTeX.
    – moewe
    Dec 7 at 7:35

















up vote
6
down vote

favorite












I want to write label and ref with Cyrillic(Russian) characters in pdflatex. usepackage[russian]{babel} in preamble.



I tried label{detokenize{}}, but it doesn't work.



documentclass[a4paper,12pt]{article} 
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{Ссылка_на_раздел}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}









share|improve this question




















  • 1




    Welcome to TeX.SX! Could you please add a complete but minimal example document with your attempts?
    – siracusa
    Dec 7 at 7:04






  • 2




    With pdfLaTeX I would only use safe ASCII characters in labels. Sometimes certain non-ASCII characters may work by accident, but that is not at all guaranteed (e.g. section{Ä}label{ä}ref{ä} works for me, but section{ß}label{ß}ref{ß} fails spectacularly). If you want non-ASCII labels you need to use a full Unicode engine such as XeLaTeX or LuaLaTeX.
    – moewe
    Dec 7 at 7:35















up vote
6
down vote

favorite









up vote
6
down vote

favorite











I want to write label and ref with Cyrillic(Russian) characters in pdflatex. usepackage[russian]{babel} in preamble.



I tried label{detokenize{}}, but it doesn't work.



documentclass[a4paper,12pt]{article} 
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{Ссылка_на_раздел}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}









share|improve this question















I want to write label and ref with Cyrillic(Russian) characters in pdflatex. usepackage[russian]{babel} in preamble.



I tried label{detokenize{}}, but it doesn't work.



documentclass[a4paper,12pt]{article} 
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{Ссылка_на_раздел}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}






pdftex labels ref russian






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 7 at 10:37









pluton

7,949960131




7,949960131










asked Dec 7 at 6:56









Shalom Alecheim

405




405








  • 1




    Welcome to TeX.SX! Could you please add a complete but minimal example document with your attempts?
    – siracusa
    Dec 7 at 7:04






  • 2




    With pdfLaTeX I would only use safe ASCII characters in labels. Sometimes certain non-ASCII characters may work by accident, but that is not at all guaranteed (e.g. section{Ä}label{ä}ref{ä} works for me, but section{ß}label{ß}ref{ß} fails spectacularly). If you want non-ASCII labels you need to use a full Unicode engine such as XeLaTeX or LuaLaTeX.
    – moewe
    Dec 7 at 7:35
















  • 1




    Welcome to TeX.SX! Could you please add a complete but minimal example document with your attempts?
    – siracusa
    Dec 7 at 7:04






  • 2




    With pdfLaTeX I would only use safe ASCII characters in labels. Sometimes certain non-ASCII characters may work by accident, but that is not at all guaranteed (e.g. section{Ä}label{ä}ref{ä} works for me, but section{ß}label{ß}ref{ß} fails spectacularly). If you want non-ASCII labels you need to use a full Unicode engine such as XeLaTeX or LuaLaTeX.
    – moewe
    Dec 7 at 7:35










1




1




Welcome to TeX.SX! Could you please add a complete but minimal example document with your attempts?
– siracusa
Dec 7 at 7:04




Welcome to TeX.SX! Could you please add a complete but minimal example document with your attempts?
– siracusa
Dec 7 at 7:04




2




2




With pdfLaTeX I would only use safe ASCII characters in labels. Sometimes certain non-ASCII characters may work by accident, but that is not at all guaranteed (e.g. section{Ä}label{ä}ref{ä} works for me, but section{ß}label{ß}ref{ß} fails spectacularly). If you want non-ASCII labels you need to use a full Unicode engine such as XeLaTeX or LuaLaTeX.
– moewe
Dec 7 at 7:35






With pdfLaTeX I would only use safe ASCII characters in labels. Sometimes certain non-ASCII characters may work by accident, but that is not at all guaranteed (e.g. section{Ä}label{ä}ref{ä} works for me, but section{ß}label{ß}ref{ß} fails spectacularly). If you want non-ASCII labels you need to use a full Unicode engine such as XeLaTeX or LuaLaTeX.
– moewe
Dec 7 at 7:35












1 Answer
1






active

oldest

votes

















up vote
6
down vote



accepted










It sort of works if you do a “double detokenization”:



documentclass[a4paper,12pt]{article}
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{detokenize{Ссылка_на_раздел}}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}


enter image description here



What's the problem? With a single detokenize, the label is written as is in the .aux file, but when the .aux file is read in, the Cyrillic characters are no longer “detokenized” and it's impossible to form control sequence names with them.



You see you can, is it worth the pain? I don't think so. On the other hand, Unicode TeX engines such as XeLaTeX and LuaLaTeX have no problem with those characters in labels.






share|improve this answer





















  • It works as I expected, unless hyperref package destroys all success even it placed before or after redefined label and ref
    – Shalom Alecheim
    Dec 7 at 10:45










  • @ShalomAlecheim hyperref does further massaging, so it's kind of expected that it doesn't work.
    – egreg
    Dec 7 at 12:45











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',
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%2f463639%2fcyrilic-characters-in-label-and-ref-in-pdflatex%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








up vote
6
down vote



accepted










It sort of works if you do a “double detokenization”:



documentclass[a4paper,12pt]{article}
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{detokenize{Ссылка_на_раздел}}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}


enter image description here



What's the problem? With a single detokenize, the label is written as is in the .aux file, but when the .aux file is read in, the Cyrillic characters are no longer “detokenized” and it's impossible to form control sequence names with them.



You see you can, is it worth the pain? I don't think so. On the other hand, Unicode TeX engines such as XeLaTeX and LuaLaTeX have no problem with those characters in labels.






share|improve this answer





















  • It works as I expected, unless hyperref package destroys all success even it placed before or after redefined label and ref
    – Shalom Alecheim
    Dec 7 at 10:45










  • @ShalomAlecheim hyperref does further massaging, so it's kind of expected that it doesn't work.
    – egreg
    Dec 7 at 12:45















up vote
6
down vote



accepted










It sort of works if you do a “double detokenization”:



documentclass[a4paper,12pt]{article}
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{detokenize{Ссылка_на_раздел}}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}


enter image description here



What's the problem? With a single detokenize, the label is written as is in the .aux file, but when the .aux file is read in, the Cyrillic characters are no longer “detokenized” and it's impossible to form control sequence names with them.



You see you can, is it worth the pain? I don't think so. On the other hand, Unicode TeX engines such as XeLaTeX and LuaLaTeX have no problem with those characters in labels.






share|improve this answer





















  • It works as I expected, unless hyperref package destroys all success even it placed before or after redefined label and ref
    – Shalom Alecheim
    Dec 7 at 10:45










  • @ShalomAlecheim hyperref does further massaging, so it's kind of expected that it doesn't work.
    – egreg
    Dec 7 at 12:45













up vote
6
down vote



accepted







up vote
6
down vote



accepted






It sort of works if you do a “double detokenization”:



documentclass[a4paper,12pt]{article}
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{detokenize{Ссылка_на_раздел}}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}


enter image description here



What's the problem? With a single detokenize, the label is written as is in the .aux file, but when the .aux file is read in, the Cyrillic characters are no longer “detokenized” and it's impossible to form control sequence names with them.



You see you can, is it worth the pain? I don't think so. On the other hand, Unicode TeX engines such as XeLaTeX and LuaLaTeX have no problem with those characters in labels.






share|improve this answer












It sort of works if you do a “double detokenization”:



documentclass[a4paper,12pt]{article}
usepackage[utf8]{inputenc}
usepackage[russian]{babel}

begin{document}
section{Раздел}
label{detokenize{detokenize{Ссылка_на_раздел}}}
Русский текст ref{detokenize{Ссылка_на_раздел}}
end{document}


enter image description here



What's the problem? With a single detokenize, the label is written as is in the .aux file, but when the .aux file is read in, the Cyrillic characters are no longer “detokenized” and it's impossible to form control sequence names with them.



You see you can, is it worth the pain? I don't think so. On the other hand, Unicode TeX engines such as XeLaTeX and LuaLaTeX have no problem with those characters in labels.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 7 at 8:35









egreg

704k8618763155




704k8618763155












  • It works as I expected, unless hyperref package destroys all success even it placed before or after redefined label and ref
    – Shalom Alecheim
    Dec 7 at 10:45










  • @ShalomAlecheim hyperref does further massaging, so it's kind of expected that it doesn't work.
    – egreg
    Dec 7 at 12:45


















  • It works as I expected, unless hyperref package destroys all success even it placed before or after redefined label and ref
    – Shalom Alecheim
    Dec 7 at 10:45










  • @ShalomAlecheim hyperref does further massaging, so it's kind of expected that it doesn't work.
    – egreg
    Dec 7 at 12:45
















It works as I expected, unless hyperref package destroys all success even it placed before or after redefined label and ref
– Shalom Alecheim
Dec 7 at 10:45




It works as I expected, unless hyperref package destroys all success even it placed before or after redefined label and ref
– Shalom Alecheim
Dec 7 at 10:45












@ShalomAlecheim hyperref does further massaging, so it's kind of expected that it doesn't work.
– egreg
Dec 7 at 12:45




@ShalomAlecheim hyperref does further massaging, so it's kind of expected that it doesn't work.
– egreg
Dec 7 at 12:45


















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%2f463639%2fcyrilic-characters-in-label-and-ref-in-pdflatex%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

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?