0

This is a follow-up on man -t converts - to −

This time the problem is with ^ which troff thinks should be changed into ˆ.

Is there a general way of telling man -t not to mess with the input?

If not: How do I fix the ˆ?

MCVE:

$ cat foo.pod
#!/usr/bin/perl -w

=head1 A

  ^

=cut

$ pod2man foo.pod | man -tl - | ps2pdf - foo.pdf
0

1 Answer 1

1

Troff turns ^ into a circumflex accent.

The simple solution to your issue, with a not-so-simple implementation, is to arrange that every ^ in the pod file gets turned into the troff sequence \(ha. I don't know the internals of Pod.pm, so instead of patching that I'll give a filter you can use on the output of pod2man, before it gets sent to man -t.

Complicating matters is that pod2man produces some lines with ^ in them. We can't alter them.

pod2man foo.pod | \
perl -pe '/\.[ ]*ds[ ]*\^/ || s/(?<!\\\*)\^/\\(ha/g' | \
man -tl - | ps2pdf - foo.pdf

The Perl command does this:

  • if the line contains a .ds ^ directive, don't alter it
  • otherwise, every occurrence of ^ is replaced by \(ha, but \*^ isn't touched.
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .