alltt in PDF to give ASCII 96 (backquote), not U+2018
When I convert the MWE below to PDF (using pdflatex
) all occurrences of the backquotes cut-and-paste out of the PDF as U+2018 (a "curly backquote") rather than U+0060 (an ASCII backquote, or backtick character).
Is there any way of giving users of the documentation something that will cut-and-paste in the way I want? I do need it to be in the alltt
environment (or similar) to get layout and ability to insert various commands.
documentclass{article}
usepackage{alltt}
usepackage[T1]{fontenc}
newcommand{bq}{char'140}
begin{document}
begin{alltt}
`hello`
bq{}worldbq{}
end{alltt}
For reference (I need it in the alltt environment or similar): bq{}hello, worldbq
end{document}
The usepackage[T1]{fontenc}
is there because I attempted to follow the advice for the listing package in How to make sure I get regular ASCII quotes in code examples when using `listings`
fonts pdftex
add a comment |
When I convert the MWE below to PDF (using pdflatex
) all occurrences of the backquotes cut-and-paste out of the PDF as U+2018 (a "curly backquote") rather than U+0060 (an ASCII backquote, or backtick character).
Is there any way of giving users of the documentation something that will cut-and-paste in the way I want? I do need it to be in the alltt
environment (or similar) to get layout and ability to insert various commands.
documentclass{article}
usepackage{alltt}
usepackage[T1]{fontenc}
newcommand{bq}{char'140}
begin{document}
begin{alltt}
`hello`
bq{}worldbq{}
end{alltt}
For reference (I need it in the alltt environment or similar): bq{}hello, worldbq
end{document}
The usepackage[T1]{fontenc}
is there because I attempted to follow the advice for the listing package in How to make sure I get regular ASCII quotes in code examples when using `listings`
fonts pdftex
add a comment |
When I convert the MWE below to PDF (using pdflatex
) all occurrences of the backquotes cut-and-paste out of the PDF as U+2018 (a "curly backquote") rather than U+0060 (an ASCII backquote, or backtick character).
Is there any way of giving users of the documentation something that will cut-and-paste in the way I want? I do need it to be in the alltt
environment (or similar) to get layout and ability to insert various commands.
documentclass{article}
usepackage{alltt}
usepackage[T1]{fontenc}
newcommand{bq}{char'140}
begin{document}
begin{alltt}
`hello`
bq{}worldbq{}
end{alltt}
For reference (I need it in the alltt environment or similar): bq{}hello, worldbq
end{document}
The usepackage[T1]{fontenc}
is there because I attempted to follow the advice for the listing package in How to make sure I get regular ASCII quotes in code examples when using `listings`
fonts pdftex
When I convert the MWE below to PDF (using pdflatex
) all occurrences of the backquotes cut-and-paste out of the PDF as U+2018 (a "curly backquote") rather than U+0060 (an ASCII backquote, or backtick character).
Is there any way of giving users of the documentation something that will cut-and-paste in the way I want? I do need it to be in the alltt
environment (or similar) to get layout and ability to insert various commands.
documentclass{article}
usepackage{alltt}
usepackage[T1]{fontenc}
newcommand{bq}{char'140}
begin{document}
begin{alltt}
`hello`
bq{}worldbq{}
end{alltt}
For reference (I need it in the alltt environment or similar): bq{}hello, worldbq
end{document}
The usepackage[T1]{fontenc}
is there because I attempted to follow the advice for the listing package in How to make sure I get regular ASCII quotes in code examples when using `listings`
fonts pdftex
fonts pdftex
edited 5 hours ago
Michael Norrish
asked 6 hours ago
Michael NorrishMichael Norrish
24428
24428
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Short answer:
`{}
If you want to use the T1 encoding, this works:
documentclass[varwidth=10cm, preview]{standalone}
usepackage[T1]{fontenc}
usepackage{textcomp}
usepackage{alltt}
% In T1, the backtick is encoded as "00
DeclareTextSymbol{bt}{T1}{"00}
begin{document}
begin{alltt}
This is a grave accent, or backtick: bt. So is this: `{}.
end{alltt}
end{document}
The T1 encoding has a different layout than ASCII.
If you want to use Unicode (whose first 128 characters are the same as ASCII), you can load fontspec
and then either use symbol{"0060}
, or turn off Ligatures = TeX
.
`{}
still works in either OT1, T1 or TU, so it’s your best bet.
I'm not committed to T1 at all (as per question), that was included because of it seeming to be the right answer for the earlier problem.
– Michael Norrish
4 hours ago
So thanks very much for the short `{} answer!
– Michael Norrish
4 hours ago
add a comment |
You need upquote
and textcomp
:
documentclass{article}
usepackage[T1]{fontenc}
usepackage{alltt,upquote,textcomp}
begin{document}
begin{alltt}
`hello`
end{alltt}
end{document}
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/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%2f472318%2falltt-in-pdf-to-give-ascii-96-backquote-not-u2018%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
Short answer:
`{}
If you want to use the T1 encoding, this works:
documentclass[varwidth=10cm, preview]{standalone}
usepackage[T1]{fontenc}
usepackage{textcomp}
usepackage{alltt}
% In T1, the backtick is encoded as "00
DeclareTextSymbol{bt}{T1}{"00}
begin{document}
begin{alltt}
This is a grave accent, or backtick: bt. So is this: `{}.
end{alltt}
end{document}
The T1 encoding has a different layout than ASCII.
If you want to use Unicode (whose first 128 characters are the same as ASCII), you can load fontspec
and then either use symbol{"0060}
, or turn off Ligatures = TeX
.
`{}
still works in either OT1, T1 or TU, so it’s your best bet.
I'm not committed to T1 at all (as per question), that was included because of it seeming to be the right answer for the earlier problem.
– Michael Norrish
4 hours ago
So thanks very much for the short `{} answer!
– Michael Norrish
4 hours ago
add a comment |
Short answer:
`{}
If you want to use the T1 encoding, this works:
documentclass[varwidth=10cm, preview]{standalone}
usepackage[T1]{fontenc}
usepackage{textcomp}
usepackage{alltt}
% In T1, the backtick is encoded as "00
DeclareTextSymbol{bt}{T1}{"00}
begin{document}
begin{alltt}
This is a grave accent, or backtick: bt. So is this: `{}.
end{alltt}
end{document}
The T1 encoding has a different layout than ASCII.
If you want to use Unicode (whose first 128 characters are the same as ASCII), you can load fontspec
and then either use symbol{"0060}
, or turn off Ligatures = TeX
.
`{}
still works in either OT1, T1 or TU, so it’s your best bet.
I'm not committed to T1 at all (as per question), that was included because of it seeming to be the right answer for the earlier problem.
– Michael Norrish
4 hours ago
So thanks very much for the short `{} answer!
– Michael Norrish
4 hours ago
add a comment |
Short answer:
`{}
If you want to use the T1 encoding, this works:
documentclass[varwidth=10cm, preview]{standalone}
usepackage[T1]{fontenc}
usepackage{textcomp}
usepackage{alltt}
% In T1, the backtick is encoded as "00
DeclareTextSymbol{bt}{T1}{"00}
begin{document}
begin{alltt}
This is a grave accent, or backtick: bt. So is this: `{}.
end{alltt}
end{document}
The T1 encoding has a different layout than ASCII.
If you want to use Unicode (whose first 128 characters are the same as ASCII), you can load fontspec
and then either use symbol{"0060}
, or turn off Ligatures = TeX
.
`{}
still works in either OT1, T1 or TU, so it’s your best bet.
Short answer:
`{}
If you want to use the T1 encoding, this works:
documentclass[varwidth=10cm, preview]{standalone}
usepackage[T1]{fontenc}
usepackage{textcomp}
usepackage{alltt}
% In T1, the backtick is encoded as "00
DeclareTextSymbol{bt}{T1}{"00}
begin{document}
begin{alltt}
This is a grave accent, or backtick: bt. So is this: `{}.
end{alltt}
end{document}
The T1 encoding has a different layout than ASCII.
If you want to use Unicode (whose first 128 characters are the same as ASCII), you can load fontspec
and then either use symbol{"0060}
, or turn off Ligatures = TeX
.
`{}
still works in either OT1, T1 or TU, so it’s your best bet.
edited 5 hours ago
answered 5 hours ago
DavislorDavislor
5,7871127
5,7871127
I'm not committed to T1 at all (as per question), that was included because of it seeming to be the right answer for the earlier problem.
– Michael Norrish
4 hours ago
So thanks very much for the short `{} answer!
– Michael Norrish
4 hours ago
add a comment |
I'm not committed to T1 at all (as per question), that was included because of it seeming to be the right answer for the earlier problem.
– Michael Norrish
4 hours ago
So thanks very much for the short `{} answer!
– Michael Norrish
4 hours ago
I'm not committed to T1 at all (as per question), that was included because of it seeming to be the right answer for the earlier problem.
– Michael Norrish
4 hours ago
I'm not committed to T1 at all (as per question), that was included because of it seeming to be the right answer for the earlier problem.
– Michael Norrish
4 hours ago
So thanks very much for the short `{} answer!
– Michael Norrish
4 hours ago
So thanks very much for the short `{} answer!
– Michael Norrish
4 hours ago
add a comment |
You need upquote
and textcomp
:
documentclass{article}
usepackage[T1]{fontenc}
usepackage{alltt,upquote,textcomp}
begin{document}
begin{alltt}
`hello`
end{alltt}
end{document}
add a comment |
You need upquote
and textcomp
:
documentclass{article}
usepackage[T1]{fontenc}
usepackage{alltt,upquote,textcomp}
begin{document}
begin{alltt}
`hello`
end{alltt}
end{document}
add a comment |
You need upquote
and textcomp
:
documentclass{article}
usepackage[T1]{fontenc}
usepackage{alltt,upquote,textcomp}
begin{document}
begin{alltt}
`hello`
end{alltt}
end{document}
You need upquote
and textcomp
:
documentclass{article}
usepackage[T1]{fontenc}
usepackage{alltt,upquote,textcomp}
begin{document}
begin{alltt}
`hello`
end{alltt}
end{document}
answered 5 hours ago
egregegreg
716k8619003188
716k8619003188
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%2f472318%2falltt-in-pdf-to-give-ascii-96-backquote-not-u2018%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