Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I created a markdown document in emacs. The document is in Ukrainian, so it has some cyrillic letters. I'm trying to convert it to pdf using pandoc mode. But it fails with:

markdown2pdf: ! LaTeX Error: Command \CYRP unavailable in encoding OT1.
! LaTeX Error: Command \cyrl unavailable in encoding OT1.
! LaTeX Error: Command \cyra unavailable in encoding OT1.
! LaTeX Error: Command \cyrn unavailable in encoding OT1.
! LaTeX Error: Command \CYRV unavailable in encoding OT1.
! LaTeX Error: Command \cyrs unavailable in encoding OT1.
! LaTeX Error: Command \cyrt unavailable in encoding OT1.
! LaTeX Error: Command \cyru unavailable in encoding OT1.
! LaTeX Error: Command \cyrp unavailable in encoding OT1.
! LaTeX Error: Command \CYRN unavailable in encoding OT1.
! LaTeX Error: Command \cyre unavailable in encoding OT1.
! LaTeX Error: Command \cyrv unavailable in encoding OT1.
! LaTeX Error: Command \cyre unavailable in encoding OT1.
! LaTeX Error: Command \cyrl unavailable in encoding OT1.
! LaTeX Error: Command \cyri unavailable in encoding OT1.
! LaTeX Error: Command \cyrk unavailable in encoding OT1.
! LaTeX Error: Command \cyri unavailable in encoding OT1.
! LaTeX Error: Command \cyrishrt unavailable in encoding OT1.
! LaTeX Error: Command \cyrv unavailable in encoding OT1.
! LaTeX Error: Command \cyrs unavailable in encoding OT1.
! LaTeX Error: Command \cyrt unavailable in encoding OT1.
! LaTeX Error: Command \cyru unavailable in encoding OT1.
! LaTeX Error: Command \cyrp unavailable in encoding OT1.
! LaTeX Error: Command \cyrd unavailable in encoding OT1.
! LaTeX Error: Command \cyro unavailable in encoding OT1.
! LaTeX Error: Command \CYRO unavailable in encoding OT1.
! LaTeX Error: Command \CYRO unavailable in encoding OT1.
! LaTeX Error: Command \cyrp unavailable in encoding OT1.
! LaTeX Error: Command \cyrr unavailable in encoding OT1.
! LaTeX Error: Command \cyro unavailable in encoding OT1.
! LaTeX Error: Command \cyrg unavailable in encoding OT1.
! LaTeX Error: Command \cyrr unavailable in encoding OT1.
! LaTeX Error: Command \cyra unavailable in encoding OT1.
! LaTeX Error: Command \cyrm unavailable in encoding OT1.
! LaTeX Error: Command \cyru unavailable in encoding OT1.
! LaTeX Error: Command \cyrv unavailable in encoding OT1.
! LaTeX Error: Command \cyra unavailable in encoding OT1.
! LaTeX Error: Command \cyrn unavailable in encoding OT1.
markdown2pdf: /tmp/pandoc/Thesis-outline-ukr.log: hGetContents: invalid argument (Invalid or incomplete multibyte or wide character)

How do I make it use the correct encoding? Should I specify something in my markdown document? Or is there any settings for the markdown2pdf itself?

UPD: I added this to .emacs, but it did not help:

;; set up unicode
(prefer-coding-system       'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; This from a japanese individual.  I hope it works.
(setq default-buffer-file-coding-system 'utf-8)
;; From Emacs wiki
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))

UPD2: The markdown file is here. Checksums:

gleontiev@gleontiev-laptop:~$ sum Documents/Thesis-outline-ukr.markdown 
17120     4
gleontiev@gleontiev-laptop:~$ cksum Documents/Thesis-outline-ukr.markdown 
2128209357 4078 Documents/Thesis-outline-ukr.markdown
gleontiev@gleontiev-laptop:~$ openssl dgst -sha1 Documents/Thesis-outline-ukr.markdown 
SHA1(Documents/Thesis-outline-ukr.markdown)= d36a0b4fb051e6928751eba152a5555768d1cb13
share|improve this question

2 Answers 2

I believe markdown expects Unicode. perhaps you could try using recode to change the encoding from your default encoding to UTF8.


According to the Pandoc markdown2pdf manual

Input is assumed to be in the UTF–8 character encoding. If your local character encoding is not UTF–8, you should pipe input through iconv:

iconv -t utf-8 input.txt | markdown2pdf

markdown2pdf assumes that the unicode, array, fancyvrb, graphicx, and ulem packages are in latex’s search path. If these packages are not included in your latex setup, they can be obtained from http://ctan.org.

Admittedly, although I indirectly use LaTeX, I often find it's error and warning messages difficult to understand and act upon. So, although the above looks like a promising avenue, it may turn out to be a dead end.


Another possibility is to try markdown in conjunction with htmldoc instead of Pandoc's markdown2pdf - I don't know if it will solve the problem, but it may be worth trying.


I'm not getting the same checksums as you

$ wget -O Cyrillic2.markdown.txt http://paste.ideaslabs.com/download/J58n5B6cGp
11:06:08 (20.53 KB/s) - `Cyrillic2.markdown.txt' saved [4078/4078]

$ sum Cyrillic2.markdown.txt
40224     4 Cyrillic2.markdown.txt

$ cksum Cyrillic2.markdown.txt
3250703884 4078 Cyrillic2.markdown.txt

$ openssl dgst -sha1 Cyrillic2.markdown.txt
SHA1(Cyrillic2.markdown.txt)= e1d6d92b5c7a3c8673ab5dff4bfe01628b17d77a
share|improve this answer
    
I updated my answer. Setting default encoding in emacs and running recode UTF8 <filename> did not help. –  folone Nov 15 '10 at 9:16
    
Can you provide a small sample markdown file? ideally with a checksum. –  RedGrittyBrick Nov 15 '10 at 9:51
    
See edited answer for checksum –  RedGrittyBrick Nov 15 '10 at 10:17
    
I updated my question with checksums. –  folone Nov 15 '10 at 10:43
    
Sorry, I can't get it to work any better than you did. See other suggestion above. –  RedGrittyBrick Nov 15 '10 at 11:00
  1. Generate TeX from markdown using pandoc.
  2. Edit the tex file. Locate the command

    \usepackage[T1]{fontenc}
    

    and change it to

    \usepackage[T2A]{fontenc}
    
  3. Add the following command, too:

    \usepackage[ukrainian]{babel}
    
  4. Compile the tex file using pdflatex.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.