How can I write special characters in RMarkdown latex documents?

前端 未结 4 1861
广开言路
广开言路 2020-12-10 18:17

I am trying ot write a paper in RMarkdown pdf. But I dont know how to use special characters like \"İ, ı, ğ, ü, ö\". Those characters are present in Turkish. I can easily us

4条回答
  •  天命终不由人
    2020-12-10 18:56

    HTML codes for Turkish characters will work (example from wikipedia):

    ---
    title: "My doc"
    output: pdf_document
    ---
    
    HTML      char  detail                            anglicized
    -------   --    ------------------------------    ---
    Ğ   Ğ       Uppercase "G" with breve accent   gh1
    İ     İ     Uppercase dotted "I"²               i (as in "tree")
    Ş     Ş     Uppercase "S" with cedilla          sh
    ğ     ğ     Lowercase "g" with breve accent   gh1
    ı     ı     Lowercase dotless "i"³              ou (as in "in")
    ş     ş     Lowercase "s" with cedilla          sh
    -------   --    -------------------------------   --
    

    Which renders the PDF like this:

    enter image description here

    For article templates, see the rticles package, or make your own

    For book templates, have a look at pandoc ebook, gitbook and bookdown


    This xelatex option I initially suggested will not work for Turkish characters:

    The xelatex engine is recommended for this kind of thing. Then you can access your system fonts with the mainfont argument:

    ---
    title: "My doc"
    output:
      pdf_document:
        latex_engine: xelatex
    mainfont: "name of your system font that has all those characters"
    ---
    
    PDF output will be in the font you specify. 
    
    Just type as normal with no special codes.
    

提交回复
热议问题