1

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!

dublc
  • 13
  • 4
  • You need support for UTF8, not Swedish or French. In UTF8 non-US_ASCII characters are converted to two or more bytes. Try `-Tutf8` or `-Tpdf` – Panagiotis Kanavos Feb 14 '23 at 12:57
  • 1
    As for `seems like no one is using Groff`... no one is using LaTex outside universities either. – Panagiotis Kanavos Feb 14 '23 at 13:01
  • Running command; '$ groff -ms example.ms -Tutf8 -Tpdf > spec.pdf' Gives me the same result I had before. If I run only with -Tutf8 then when trying to view with mupdf I get an error. If I forego the pdf and just run it straight to the terminal I get the same unchanged content as if I hadn't added -Tutf8 – dublc Feb 14 '23 at 15:37

1 Answers1

2

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

Ljm Dullaart
  • 4,273
  • 2
  • 14
  • 31