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












2















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





























    2















    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



























      2












      2








      2








      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 6 hours ago







      Michael Norrish

















      asked 6 hours ago









      Michael NorrishMichael Norrish

      24428




      24428






















          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
            5 hours ago











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

            – Michael Norrish
            5 hours ago



















          4














          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
              5 hours ago











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

              – Michael Norrish
              5 hours ago
















            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
              5 hours ago











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

              – Michael Norrish
              5 hours ago














            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 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
              5 hours ago











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

              – Michael Norrish
              5 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
              5 hours ago











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

              – Michael Norrish
              5 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
            5 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
            5 hours ago













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

            – Michael Norrish
            5 hours ago





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

            – Michael Norrish
            5 hours ago











            4














            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




























              4














              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


























                4












                4








                4







                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 5 hours ago









                egregegreg

                716k8619003188




                716k8619003188






























                    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

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin