Putting a user defined Latex environment into R markdown or knitr The 2019 Stack Overflow...

Why can Shazam do this?

Can we apply L'Hospital's rule where the derivative is not continuous?

Geography at the pixel level

Deadlock Graph and Interpretation, solution to avoid

"Riffle" two strings

How to answer pointed "are you quitting" questioning when I don't want them to suspect

What is the motivation for a law requiring 2 parties to consent for recording a conversation

Why is it "Tumoren" and not "Tumore"?

How are circuits which use complex ICs normally simulated?

What tool would a Roman-age civilization have to grind silver and other metals into dust?

Is there a name of the flying bionic bird?

Manuscript was "unsubmitted" because the manuscript was deposited in Arxiv Preprints

A poker game description that does not feel gimmicky

Can I write a for loop that iterates over both collections and arrays?

Monty Hall variation

"What time...?" or "At what time...?" - what is more grammatically correct?

How to deal with fear of taking dependencies

Extreme, unacceptable situation and I can't attend work tomorrow morning

Does duplicating a spell with wish count as casting that spell?

Is domain driven design an anti-SQL pattern?

What is the best strategy for white in this position?

Pristine Bit Checking

What is the meaning of Triage in Cybersec world?

If a poisoned arrow's piercing damage is reduced to 0, do you still get poisoned?



Putting a user defined Latex environment into R markdown or knitr



The 2019 Stack Overflow Developer Survey Results Are InWhat does this error mean?: begin document ended by end proofDuplicating the amsthm proof environmentProblem with an environment definitionAutomating extraction of Markdown-formatted tables from an (incomplete) LaTeX documentSymbol at the end of an environmentPutting custom environment (using environ package) start and ends in commandsArray command in Latexexcludecomment fails when used with newenvironmentmapsto and function definition / definition environmentLaTeX with markdown and tables












2















I am getting an error when I try to include a user defined environment in my R markdown document. I have at the top:



header_includes:
- usepackage{amsmath}
- usepackage{amssymb}
- usepackage{amsthm}
- newtheorem{assumption}{Assumption}


And then in the document itself, if I write



begin{assumption}
$a > b$
end{assumption}


I get the error "! Undefined Control Sequence begin{assumption}" when I click compile.



I don't get an error if I use a regular proof environment or equation environment. That is,



begin{equation}
a^2 + b^2 = c^2
end{equation}


does not give me an error. Of course, including the "header_includes" part in the preamble of a latex document and then using the assumption environment in that latex document is no problem. It would just be nice if I could copy and paste Latex directly into R markdown, since TexStudio has many nice autocompletion features and coloring schemes that make it the better environment to write latex, but Markdown is the easier way to integrate LaTex and code.
Any help would be great. Thanks!










share|improve this question























  • Could you please post a minimal (non)working example?

    – Boris
    Mar 25 '17 at 5:51
















2















I am getting an error when I try to include a user defined environment in my R markdown document. I have at the top:



header_includes:
- usepackage{amsmath}
- usepackage{amssymb}
- usepackage{amsthm}
- newtheorem{assumption}{Assumption}


And then in the document itself, if I write



begin{assumption}
$a > b$
end{assumption}


I get the error "! Undefined Control Sequence begin{assumption}" when I click compile.



I don't get an error if I use a regular proof environment or equation environment. That is,



begin{equation}
a^2 + b^2 = c^2
end{equation}


does not give me an error. Of course, including the "header_includes" part in the preamble of a latex document and then using the assumption environment in that latex document is no problem. It would just be nice if I could copy and paste Latex directly into R markdown, since TexStudio has many nice autocompletion features and coloring schemes that make it the better environment to write latex, but Markdown is the easier way to integrate LaTex and code.
Any help would be great. Thanks!










share|improve this question























  • Could you please post a minimal (non)working example?

    – Boris
    Mar 25 '17 at 5:51














2












2








2








I am getting an error when I try to include a user defined environment in my R markdown document. I have at the top:



header_includes:
- usepackage{amsmath}
- usepackage{amssymb}
- usepackage{amsthm}
- newtheorem{assumption}{Assumption}


And then in the document itself, if I write



begin{assumption}
$a > b$
end{assumption}


I get the error "! Undefined Control Sequence begin{assumption}" when I click compile.



I don't get an error if I use a regular proof environment or equation environment. That is,



begin{equation}
a^2 + b^2 = c^2
end{equation}


does not give me an error. Of course, including the "header_includes" part in the preamble of a latex document and then using the assumption environment in that latex document is no problem. It would just be nice if I could copy and paste Latex directly into R markdown, since TexStudio has many nice autocompletion features and coloring schemes that make it the better environment to write latex, but Markdown is the easier way to integrate LaTex and code.
Any help would be great. Thanks!










share|improve this question














I am getting an error when I try to include a user defined environment in my R markdown document. I have at the top:



header_includes:
- usepackage{amsmath}
- usepackage{amssymb}
- usepackage{amsthm}
- newtheorem{assumption}{Assumption}


And then in the document itself, if I write



begin{assumption}
$a > b$
end{assumption}


I get the error "! Undefined Control Sequence begin{assumption}" when I click compile.



I don't get an error if I use a regular proof environment or equation environment. That is,



begin{equation}
a^2 + b^2 = c^2
end{equation}


does not give me an error. Of course, including the "header_includes" part in the preamble of a latex document and then using the assumption environment in that latex document is no problem. It would just be nice if I could copy and paste Latex directly into R markdown, since TexStudio has many nice autocompletion features and coloring schemes that make it the better environment to write latex, but Markdown is the easier way to integrate LaTex and code.
Any help would be great. Thanks!







environments knitr sweave markdown






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 '17 at 3:16









Notarobot2244Notarobot2244

113




113













  • Could you please post a minimal (non)working example?

    – Boris
    Mar 25 '17 at 5:51



















  • Could you please post a minimal (non)working example?

    – Boris
    Mar 25 '17 at 5:51

















Could you please post a minimal (non)working example?

– Boris
Mar 25 '17 at 5:51





Could you please post a minimal (non)working example?

– Boris
Mar 25 '17 at 5:51










2 Answers
2






active

oldest

votes


















2














You don't need to list the newtheorem macro as a header_includes argument, just put it at the top of your document:




---

title: "Test"

header_includes:

- usepackage{amsmath}

- usepackage{amssymb}

- usepackage{amsthm}

---



newtheorem{assumption}{Assumption}



Here's my assumption:



begin{assumption}

$a > b$

end{assumption}



And done.




enter image description here






share|improve this answer
























  • But why this does not have any effect on html? or notebook? how to tweak this to work for both?

    – David
    Aug 8 '18 at 5:48











  • that is when I present this in html slides also this should be visible. how to do that?

    – David
    Aug 8 '18 at 5:49











  • LaTeX code is only processed when your output is generated by the LaTeX program. That means pdf or Beamer slides. html slides are generated by a different backend, and that backend doesn't know LaTeX

    – Tyler
    Aug 8 '18 at 10:09



















0














how can i get, "theorem 2.1"?? i only get "Theorem 2", "Theorem 3", etc





share








New contributor




César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















    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%2f360296%2fputting-a-user-defined-latex-environment-into-r-markdown-or-knitr%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














    You don't need to list the newtheorem macro as a header_includes argument, just put it at the top of your document:




    ---

    title: "Test"

    header_includes:

    - usepackage{amsmath}

    - usepackage{amssymb}

    - usepackage{amsthm}

    ---



    newtheorem{assumption}{Assumption}



    Here's my assumption:



    begin{assumption}

    $a > b$

    end{assumption}



    And done.




    enter image description here






    share|improve this answer
























    • But why this does not have any effect on html? or notebook? how to tweak this to work for both?

      – David
      Aug 8 '18 at 5:48











    • that is when I present this in html slides also this should be visible. how to do that?

      – David
      Aug 8 '18 at 5:49











    • LaTeX code is only processed when your output is generated by the LaTeX program. That means pdf or Beamer slides. html slides are generated by a different backend, and that backend doesn't know LaTeX

      – Tyler
      Aug 8 '18 at 10:09
















    2














    You don't need to list the newtheorem macro as a header_includes argument, just put it at the top of your document:




    ---

    title: "Test"

    header_includes:

    - usepackage{amsmath}

    - usepackage{amssymb}

    - usepackage{amsthm}

    ---



    newtheorem{assumption}{Assumption}



    Here's my assumption:



    begin{assumption}

    $a > b$

    end{assumption}



    And done.




    enter image description here






    share|improve this answer
























    • But why this does not have any effect on html? or notebook? how to tweak this to work for both?

      – David
      Aug 8 '18 at 5:48











    • that is when I present this in html slides also this should be visible. how to do that?

      – David
      Aug 8 '18 at 5:49











    • LaTeX code is only processed when your output is generated by the LaTeX program. That means pdf or Beamer slides. html slides are generated by a different backend, and that backend doesn't know LaTeX

      – Tyler
      Aug 8 '18 at 10:09














    2












    2








    2







    You don't need to list the newtheorem macro as a header_includes argument, just put it at the top of your document:




    ---

    title: "Test"

    header_includes:

    - usepackage{amsmath}

    - usepackage{amssymb}

    - usepackage{amsthm}

    ---



    newtheorem{assumption}{Assumption}



    Here's my assumption:



    begin{assumption}

    $a > b$

    end{assumption}



    And done.




    enter image description here






    share|improve this answer













    You don't need to list the newtheorem macro as a header_includes argument, just put it at the top of your document:




    ---

    title: "Test"

    header_includes:

    - usepackage{amsmath}

    - usepackage{amssymb}

    - usepackage{amsthm}

    ---



    newtheorem{assumption}{Assumption}



    Here's my assumption:



    begin{assumption}

    $a > b$

    end{assumption}



    And done.




    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered May 9 '17 at 18:15









    TylerTyler

    2,1281228




    2,1281228













    • But why this does not have any effect on html? or notebook? how to tweak this to work for both?

      – David
      Aug 8 '18 at 5:48











    • that is when I present this in html slides also this should be visible. how to do that?

      – David
      Aug 8 '18 at 5:49











    • LaTeX code is only processed when your output is generated by the LaTeX program. That means pdf or Beamer slides. html slides are generated by a different backend, and that backend doesn't know LaTeX

      – Tyler
      Aug 8 '18 at 10:09



















    • But why this does not have any effect on html? or notebook? how to tweak this to work for both?

      – David
      Aug 8 '18 at 5:48











    • that is when I present this in html slides also this should be visible. how to do that?

      – David
      Aug 8 '18 at 5:49











    • LaTeX code is only processed when your output is generated by the LaTeX program. That means pdf or Beamer slides. html slides are generated by a different backend, and that backend doesn't know LaTeX

      – Tyler
      Aug 8 '18 at 10:09

















    But why this does not have any effect on html? or notebook? how to tweak this to work for both?

    – David
    Aug 8 '18 at 5:48





    But why this does not have any effect on html? or notebook? how to tweak this to work for both?

    – David
    Aug 8 '18 at 5:48













    that is when I present this in html slides also this should be visible. how to do that?

    – David
    Aug 8 '18 at 5:49





    that is when I present this in html slides also this should be visible. how to do that?

    – David
    Aug 8 '18 at 5:49













    LaTeX code is only processed when your output is generated by the LaTeX program. That means pdf or Beamer slides. html slides are generated by a different backend, and that backend doesn't know LaTeX

    – Tyler
    Aug 8 '18 at 10:09





    LaTeX code is only processed when your output is generated by the LaTeX program. That means pdf or Beamer slides. html slides are generated by a different backend, and that backend doesn't know LaTeX

    – Tyler
    Aug 8 '18 at 10:09











    0














    how can i get, "theorem 2.1"?? i only get "Theorem 2", "Theorem 3", etc





    share








    New contributor




    César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      how can i get, "theorem 2.1"?? i only get "Theorem 2", "Theorem 3", etc





      share








      New contributor




      César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        how can i get, "theorem 2.1"?? i only get "Theorem 2", "Theorem 3", etc





        share








        New contributor




        César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        how can i get, "theorem 2.1"?? i only get "Theorem 2", "Theorem 3", etc






        share








        New contributor




        César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        share


        share






        New contributor




        César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 5 mins ago









        CésarCésar

        1




        1




        New contributor




        César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        César is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            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%2f360296%2fputting-a-user-defined-latex-environment-into-r-markdown-or-knitr%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

            El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

            Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...

            Castillo d'Acher Características Menú de navegación