1

man -t ls converts - to −. Is there a way I can tell man -t to not do that?

I prefer having -, as the - is often part of examples where − would be wrong (e.g. options).

Ole Tange
  • 33,591
  • 31
  • 102
  • 198
  • 1
    Check out also [this question](http://unix.stackexchange.com/q/315414/119298) for man and double-quotes; the equivalent here is `(echo '.tr \--'; zcat $(man -w ls)) | man -tl -` – meuh Mar 31 '17 at 08:06

1 Answers1

4

In the original file, the minus '-' symbols really are backslashified to '\-' which would then be interpreted in the way you do not like.

A solution is to filter the file before feeding it to man for formatting:

zcat /usr/share/man/man1/ls.1.gz | man -tl - > ls-normal.ps

zcat /usr/share/man/man1/ls.1.gz | sed 's/\\-/-/g' | man -tl - > ls-minus.ps

The second form replaces the '−'s with '-'s on my system.

PS: My previous answer was wrong - apologies!

Ned64
  • 8,486
  • 9
  • 48
  • 86
  • 1
    @Ned64 +1 — the root cause is that in `troff`, `\-` encodes "minus" (which is appropriate for options, and produces output which can be copy-pasted to the command-line), whereas `-` encodes "hyphen". `groff` now treats both in the same way for text output (and HTML, at least in Debian), but apparently not for PostScript. – Stephen Kitt Mar 30 '17 at 18:38