executable code containing symbol `^` inserted with verbatim on pdf. Error while copying back into a text...











up vote
1
down vote

favorite












I'm trying to insert Octave code in a pdf containing the character ^. However when I copy the code from the generated pdf, the code doesn't run: The I already posted similar question and could solve the problem. However the problem reappeared. I suspect one of the loaded package is responsible.



Here is an example of code with the loaded packages



documentclass[a4paper, 12pt]{book}
usepackage{amssymb}
usepackage{amsmath}
usepackage{mathtools}
usepackage[utf8]{inputenc}
usepackage{geometry}
usepackage{url}
usepackage{framed}
usepackage{setspace}
usepackage{lmodern}
usepackage{multirow}
usepackage{listings}
usepackage{xcolor}
usepackage{upquote}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}

usepackage{caption}
%usepackage{calrsfs}
%DeclareMathAlphabet{pazocal}{OMS}{zplm}{m}{n}

begin{document}
setlength{parindent}{0cm}
renewcommand{baselinestretch}{0.5}
title{Notes}
author{John Smith}
date{today}
maketitle

tableofcontents{}

definecolor{shadecolor}{RGB}{240,248,255}
begin{shaded}
begin{verbatim}
x^2
end{verbatim}
end{shaded}


end{document}









share|improve this question
























  • Code produced by a listing is not necessarily meant to run and one shouldn't expect it to after just copy&pasting it.
    – Skillmon
    Dec 2 at 21:55










  • indeed when copying pasting from PDF I get the MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ) and not the usual ascii caret. Culprit is lmodern package. But add usepackage[T1]{fontenc} and it should fix the issue.
    – jfbu
    Dec 3 at 21:58












  • MWE: simply load lmodern and consider texttt{xstring^2}.
    – jfbu
    Dec 3 at 22:03










  • @UlrikeFischer you may be interested into this why does OT1/lmtt/m/n/10 ^ give a ˆ in PDF (or at least when copying back from PDF, tested with Skim on mac os x)
    – jfbu
    Dec 3 at 22:04















up vote
1
down vote

favorite












I'm trying to insert Octave code in a pdf containing the character ^. However when I copy the code from the generated pdf, the code doesn't run: The I already posted similar question and could solve the problem. However the problem reappeared. I suspect one of the loaded package is responsible.



Here is an example of code with the loaded packages



documentclass[a4paper, 12pt]{book}
usepackage{amssymb}
usepackage{amsmath}
usepackage{mathtools}
usepackage[utf8]{inputenc}
usepackage{geometry}
usepackage{url}
usepackage{framed}
usepackage{setspace}
usepackage{lmodern}
usepackage{multirow}
usepackage{listings}
usepackage{xcolor}
usepackage{upquote}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}

usepackage{caption}
%usepackage{calrsfs}
%DeclareMathAlphabet{pazocal}{OMS}{zplm}{m}{n}

begin{document}
setlength{parindent}{0cm}
renewcommand{baselinestretch}{0.5}
title{Notes}
author{John Smith}
date{today}
maketitle

tableofcontents{}

definecolor{shadecolor}{RGB}{240,248,255}
begin{shaded}
begin{verbatim}
x^2
end{verbatim}
end{shaded}


end{document}









share|improve this question
























  • Code produced by a listing is not necessarily meant to run and one shouldn't expect it to after just copy&pasting it.
    – Skillmon
    Dec 2 at 21:55










  • indeed when copying pasting from PDF I get the MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ) and not the usual ascii caret. Culprit is lmodern package. But add usepackage[T1]{fontenc} and it should fix the issue.
    – jfbu
    Dec 3 at 21:58












  • MWE: simply load lmodern and consider texttt{xstring^2}.
    – jfbu
    Dec 3 at 22:03










  • @UlrikeFischer you may be interested into this why does OT1/lmtt/m/n/10 ^ give a ˆ in PDF (or at least when copying back from PDF, tested with Skim on mac os x)
    – jfbu
    Dec 3 at 22:04













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm trying to insert Octave code in a pdf containing the character ^. However when I copy the code from the generated pdf, the code doesn't run: The I already posted similar question and could solve the problem. However the problem reappeared. I suspect one of the loaded package is responsible.



Here is an example of code with the loaded packages



documentclass[a4paper, 12pt]{book}
usepackage{amssymb}
usepackage{amsmath}
usepackage{mathtools}
usepackage[utf8]{inputenc}
usepackage{geometry}
usepackage{url}
usepackage{framed}
usepackage{setspace}
usepackage{lmodern}
usepackage{multirow}
usepackage{listings}
usepackage{xcolor}
usepackage{upquote}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}

usepackage{caption}
%usepackage{calrsfs}
%DeclareMathAlphabet{pazocal}{OMS}{zplm}{m}{n}

begin{document}
setlength{parindent}{0cm}
renewcommand{baselinestretch}{0.5}
title{Notes}
author{John Smith}
date{today}
maketitle

tableofcontents{}

definecolor{shadecolor}{RGB}{240,248,255}
begin{shaded}
begin{verbatim}
x^2
end{verbatim}
end{shaded}


end{document}









share|improve this question















I'm trying to insert Octave code in a pdf containing the character ^. However when I copy the code from the generated pdf, the code doesn't run: The I already posted similar question and could solve the problem. However the problem reappeared. I suspect one of the loaded package is responsible.



Here is an example of code with the loaded packages



documentclass[a4paper, 12pt]{book}
usepackage{amssymb}
usepackage{amsmath}
usepackage{mathtools}
usepackage[utf8]{inputenc}
usepackage{geometry}
usepackage{url}
usepackage{framed}
usepackage{setspace}
usepackage{lmodern}
usepackage{multirow}
usepackage{listings}
usepackage{xcolor}
usepackage{upquote}
usepackage{hyperref}
hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}

usepackage{caption}
%usepackage{calrsfs}
%DeclareMathAlphabet{pazocal}{OMS}{zplm}{m}{n}

begin{document}
setlength{parindent}{0cm}
renewcommand{baselinestretch}{0.5}
title{Notes}
author{John Smith}
date{today}
maketitle

tableofcontents{}

definecolor{shadecolor}{RGB}{240,248,255}
begin{shaded}
begin{verbatim}
x^2
end{verbatim}
end{shaded}


end{document}






fonts symbols code octave






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 3 at 22:02









jfbu

45.6k65146




45.6k65146










asked Dec 2 at 21:48









ecjb

764




764












  • Code produced by a listing is not necessarily meant to run and one shouldn't expect it to after just copy&pasting it.
    – Skillmon
    Dec 2 at 21:55










  • indeed when copying pasting from PDF I get the MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ) and not the usual ascii caret. Culprit is lmodern package. But add usepackage[T1]{fontenc} and it should fix the issue.
    – jfbu
    Dec 3 at 21:58












  • MWE: simply load lmodern and consider texttt{xstring^2}.
    – jfbu
    Dec 3 at 22:03










  • @UlrikeFischer you may be interested into this why does OT1/lmtt/m/n/10 ^ give a ˆ in PDF (or at least when copying back from PDF, tested with Skim on mac os x)
    – jfbu
    Dec 3 at 22:04


















  • Code produced by a listing is not necessarily meant to run and one shouldn't expect it to after just copy&pasting it.
    – Skillmon
    Dec 2 at 21:55










  • indeed when copying pasting from PDF I get the MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ) and not the usual ascii caret. Culprit is lmodern package. But add usepackage[T1]{fontenc} and it should fix the issue.
    – jfbu
    Dec 3 at 21:58












  • MWE: simply load lmodern and consider texttt{xstring^2}.
    – jfbu
    Dec 3 at 22:03










  • @UlrikeFischer you may be interested into this why does OT1/lmtt/m/n/10 ^ give a ˆ in PDF (or at least when copying back from PDF, tested with Skim on mac os x)
    – jfbu
    Dec 3 at 22:04
















Code produced by a listing is not necessarily meant to run and one shouldn't expect it to after just copy&pasting it.
– Skillmon
Dec 2 at 21:55




Code produced by a listing is not necessarily meant to run and one shouldn't expect it to after just copy&pasting it.
– Skillmon
Dec 2 at 21:55












indeed when copying pasting from PDF I get the MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ) and not the usual ascii caret. Culprit is lmodern package. But add usepackage[T1]{fontenc} and it should fix the issue.
– jfbu
Dec 3 at 21:58






indeed when copying pasting from PDF I get the MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ) and not the usual ascii caret. Culprit is lmodern package. But add usepackage[T1]{fontenc} and it should fix the issue.
– jfbu
Dec 3 at 21:58














MWE: simply load lmodern and consider texttt{xstring^2}.
– jfbu
Dec 3 at 22:03




MWE: simply load lmodern and consider texttt{xstring^2}.
– jfbu
Dec 3 at 22:03












@UlrikeFischer you may be interested into this why does OT1/lmtt/m/n/10 ^ give a ˆ in PDF (or at least when copying back from PDF, tested with Skim on mac os x)
– jfbu
Dec 3 at 22:04




@UlrikeFischer you may be interested into this why does OT1/lmtt/m/n/10 ^ give a ˆ in PDF (or at least when copying back from PDF, tested with Skim on mac os x)
– jfbu
Dec 3 at 22:04










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










I am providing this as a provisory answer to give a workaround awaiting the fonts expert (... or experts).



MWE:



documentclass{article}
%usepackage[T1]{fontenc}
usepackage{lmodern}
begin{document}
thispagestyle{empty}
texttt{xstring^2}
showoutput
end{document}


Uncomment the fontenc line to fix the issue. Then copy-pasting from PDF gives a normal ascii caret, not a MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ)






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',
    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%2f462858%2fexecutable-code-containing-symbol-inserted-with-verbatim-on-pdf-error-while%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
    2
    down vote



    accepted










    I am providing this as a provisory answer to give a workaround awaiting the fonts expert (... or experts).



    MWE:



    documentclass{article}
    %usepackage[T1]{fontenc}
    usepackage{lmodern}
    begin{document}
    thispagestyle{empty}
    texttt{xstring^2}
    showoutput
    end{document}


    Uncomment the fontenc line to fix the issue. Then copy-pasting from PDF gives a normal ascii caret, not a MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ)






    share|improve this answer

























      up vote
      2
      down vote



      accepted










      I am providing this as a provisory answer to give a workaround awaiting the fonts expert (... or experts).



      MWE:



      documentclass{article}
      %usepackage[T1]{fontenc}
      usepackage{lmodern}
      begin{document}
      thispagestyle{empty}
      texttt{xstring^2}
      showoutput
      end{document}


      Uncomment the fontenc line to fix the issue. Then copy-pasting from PDF gives a normal ascii caret, not a MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ)






      share|improve this answer























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        I am providing this as a provisory answer to give a workaround awaiting the fonts expert (... or experts).



        MWE:



        documentclass{article}
        %usepackage[T1]{fontenc}
        usepackage{lmodern}
        begin{document}
        thispagestyle{empty}
        texttt{xstring^2}
        showoutput
        end{document}


        Uncomment the fontenc line to fix the issue. Then copy-pasting from PDF gives a normal ascii caret, not a MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ)






        share|improve this answer












        I am providing this as a provisory answer to give a workaround awaiting the fonts expert (... or experts).



        MWE:



        documentclass{article}
        %usepackage[T1]{fontenc}
        usepackage{lmodern}
        begin{document}
        thispagestyle{empty}
        texttt{xstring^2}
        showoutput
        end{document}


        Uncomment the fontenc line to fix the issue. Then copy-pasting from PDF gives a normal ascii caret, not a MODIFIER LETTER CIRCUMFLEX ACCENT U+02C6 (letter ˆ)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 3 at 22:06









        jfbu

        45.6k65146




        45.6k65146






























            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%2f462858%2fexecutable-code-containing-symbol-inserted-with-verbatim-on-pdf-error-while%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?