Search code examples
mupdfgroff

Rendering Swedish Å Ä and Ö with groff, mupdf


I am learning to use groff as an alternative to Latex and am struggling with rendering Å Ä and Ö characters.

In an English only setting, I have been running groff with: $ groff -ms example.ms -T pdf > example.pdf
and then viewing my pdf with : $ mupdf example.pdf

I see in the man pages groff_tmac(5) that there is support for Swedish and when I try to extrapolate the example from French in the man pages to Swedish I do not achieve the results I want. I am still getting two strange characters in place of every Å, Ä, or Ö.

I am trying the command $ groff -ms -msv example.ms -T pdf > example.pdf

I have scoured the web both in Swedish and English (Swedish results even worse...seems like no one is using Groff) and am finding zero examples. I don't need the answer, just where someone smarter than myself would start looking. People in my circle just suggest Latex but I am determined to use the much lighter Groff.

I am expecting to have Å Ä and Ö print nicely, so I can do my assignments in groff instead of Latex.

Thank You!


Solution

  • When I have accented or non-standard-ascii characters in my input text, I run the inputfile through preconv, which solves almost all my problems.

    preconv inputfile | groff > outputfile
    

    If you dislike typing the separate preconv, you can also run groff with -k.

    If I use the following inputfile:

    
    test
    .br
    I am expecting to have Å Ä and Ö print nicely,
    

    and run it through preconv, I get

    .lf 1 inputfile
    
    test
    .br
    I am expecting to have \[u00C5] \[u00C4] and \[u00D6] print nicely,
    

    Of course, you can put in the \[u00C4] etc. by hand, but that makes groff a lot less lightweight. And the output of groff then becomes: enter image description here