alltt in PDF to give ASCII 96 (backquote), not U+2018












3















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`










share|improve this question





























    3















    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`










    share|improve this question



























      3












      3








      3








      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`










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 29 at 0:03







      Michael Norrish

















      asked Jan 28 at 23:36









      Michael NorrishMichael Norrish

      24928




      24928






















          2 Answers
          2






          active

          oldest

          votes


















          2














          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}


          Font sample



          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.






          share|improve this answer


























          • 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
            Jan 29 at 1:07











          • So thanks very much for the short `{} answer!

            – Michael Norrish
            Jan 29 at 1:08



















          6














          You need upquote and textcomp:



          documentclass{article}
          usepackage[T1]{fontenc}
          usepackage{alltt,upquote,textcomp}

          begin{document}

          begin{alltt}
          `hello`
          end{alltt}

          end{document}


          enter image description here






          share|improve this answer























            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%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









            2














            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}


            Font sample



            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.






            share|improve this answer


























            • 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
              Jan 29 at 1:07











            • So thanks very much for the short `{} answer!

              – Michael Norrish
              Jan 29 at 1:08
















            2














            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}


            Font sample



            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.






            share|improve this answer


























            • 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
              Jan 29 at 1:07











            • So thanks very much for the short `{} answer!

              – Michael Norrish
              Jan 29 at 1:08














            2












            2








            2







            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}


            Font sample



            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.






            share|improve this answer















            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}


            Font sample



            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.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 29 at 0:54

























            answered Jan 29 at 0:42









            DavislorDavislor

            6,5871329




            6,5871329













            • 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
              Jan 29 at 1:07











            • So thanks very much for the short `{} answer!

              – Michael Norrish
              Jan 29 at 1:08



















            • 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
              Jan 29 at 1:07











            • So thanks very much for the short `{} answer!

              – Michael Norrish
              Jan 29 at 1:08

















            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
            Jan 29 at 1:07





            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
            Jan 29 at 1:07













            So thanks very much for the short `{} answer!

            – Michael Norrish
            Jan 29 at 1:08





            So thanks very much for the short `{} answer!

            – Michael Norrish
            Jan 29 at 1:08











            6














            You need upquote and textcomp:



            documentclass{article}
            usepackage[T1]{fontenc}
            usepackage{alltt,upquote,textcomp}

            begin{document}

            begin{alltt}
            `hello`
            end{alltt}

            end{document}


            enter image description here






            share|improve this answer




























              6














              You need upquote and textcomp:



              documentclass{article}
              usepackage[T1]{fontenc}
              usepackage{alltt,upquote,textcomp}

              begin{document}

              begin{alltt}
              `hello`
              end{alltt}

              end{document}


              enter image description here






              share|improve this answer


























                6












                6








                6







                You need upquote and textcomp:



                documentclass{article}
                usepackage[T1]{fontenc}
                usepackage{alltt,upquote,textcomp}

                begin{document}

                begin{alltt}
                `hello`
                end{alltt}

                end{document}


                enter image description here






                share|improve this answer













                You need upquote and textcomp:



                documentclass{article}
                usepackage[T1]{fontenc}
                usepackage{alltt,upquote,textcomp}

                begin{document}

                begin{alltt}
                `hello`
                end{alltt}

                end{document}


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 29 at 0:38









                egregegreg

                725k8819183224




                725k8819183224






























                    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.




                    draft saved


                    draft discarded














                    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





















































                    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

                    Human spaceflight

                    Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                    張江高科駅