1

When I do a command such as:

man bash

I see quotes shown as:

``...''

There have been posts about why this happens:

But, I haven't found a way to force man or the underlying pager to either show an ASCII double quote (") or to embolden the characters, or anything other than using the backtick/prime characters.

My use case is that I want to be able to search the bash man page for single quotes or backticks for where they have semantic value and the clutter of non-semantic backtick/prime characters makes this difficult.

I have tried changing LC_ALL from en_us.UTF-8 to C, and have tried using man's option -P to specify other pagers/options, but I have not yet found a solution.

My environment is man 2.6.3, CentOS 7.2 (3.10.0-327.13.1.el7.x86_64), bash 4.2.46(1) or zsh 5.0.2.

My preference would be to discover a solution that causes man to render double quotes either as the ASCII double-quote character (") or to render the quoted content as formatted text (for example, by underlining or emboldening it).

This similarly applies to how man renders single-quoted content as `content'.

A poor workaround:

man bash | sed -e "s/\(''\|\`\`\)//g" -e "s/\`\([^']*\)/\1/g" | less

Can anyone tell me how to make man to not show quoted content with backticks and primes? The solution should not require the installation of any software (that is, the solution should work with a CentOS 7.2 minimal installation).

2

The backticks in the bash man page are explicitly given in the troff source, not the result of some macro, so are hard to change. However, the special single backticks are quoted \`, so you could apply your sed to the source troff instead using this difference.

Instead you can add a troff command to translate the backtick into some other character. The command .tr AXBY translates all A's into X and B's into Y. So

(echo '.tr `"'\''"'; zcat $(man -w bash)) | man /dev/stdin

translates backtick and single quote into double quotes. That leaves you with just the wanted special single backticks in the output, though you also have artifacts like the pipeline"s return.

On the whole, I think your "poor workaround" is quite adequate.

  • Thank you for describing the implementation details. I must, therefore concede that workarounds are going to be the solution to this question. I will combine your entry above with some of my sed script above as my final solution. I'm marking this as the accepted answer. Many thanks for your input! – Steve Amerige Oct 10 '16 at 22:50
2

It might not be a pleasant option, but you can use w3m as the browser for man's HTML output:

BROWSER=w3m man -H bash

enter image description here

It renders ``…'' using Unicode quotes (as does Google Chrome, but for some reason, lynx doesn't).

FreeBSD's manpage repository tells me CentOS 7's man does support -H.

  • Thanks for the thought, but I'm looking for a solution within a simple console window or within an ssh terminal session. The idea of rendering to html is inventive; but, I'm still hoping that there is a solution that can be found at man page generation time. Again, thanks. – Steve Amerige Oct 10 '16 at 13:10
  • w3m should work fine in a "simple console window" or SSH session. – muru Oct 10 '16 at 13:16
  • The package w3m is found in the epel repo and is not included in the CentOS 7 minimal installation. I'm trying hard to not require that any additional software be installed, especially any software that is not in either the CentOS base nor the update repo. I'm looking for solutions that do not require any software installation. I've added a clarification to the original post. Thanks. – Steve Amerige Oct 10 '16 at 13:22
0

Agreeing with @meuh that the quotes are embedded in the troff (manual page) sources, whether it is hard to change is debatable. That mostly depends on the developer of the given documentation. bash uses that convention to work with the related toolset, e.g., makeinfo.

For instance, xterm's manual page uses macros to get an (arguably) better appearance:

.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds AQ \(aq
.el       .ds AQ '
.ie \n(.g .ds `` \(lq
.el       .ds `` ``
.ie \n(.g .ds '' \(rq
.el       .ds '' ''

That was from a bug report (fixed in 2009):

work around groff mapping of ASCII quotes using macros (requested by Reuben Thomas based on Colin Watson advice, fixes Debian #378700).

and used, for example

.PP
Although both windows may be displayed at the same time, one of them is
considered the \*(``active\*('' window for receiving keyboard input and terminal
output.

and producing this (cut/paste from xterm to preserve the alternate quotes):

Although both windows may be displayed at the same time, one of them is considered the “active” window for receiving keyboard input and terminal output. This is the window that contains the text cursor. The active window can be chosen through escape sequences, the VT Options menu in the VTxxx window, and the Tek Options menu in the 4014 window.

A screenshot shows it better:

example from xterm

The result in PDF uses different quotes due to the condition in the macro:

PDF rendering of quote-example

So a possible improvement would be to modify the preprocessor to add the macro definitions and substitute groff's named characters rather than literal single- and double-quotes. Since neither produces ASCII by default, there would be less syntactic clutter in the result.

That reminds me that changing those "xxx" to italics would improve things (another time, perhaps).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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