[comp.text] How do you display a back-slash in nroff?

rbp@investor.pgh.pa.us (Bob Peirce #305) (08/08/90)

I have read the manual.  I have experimented with .ec and with
escaping one back-slash with one to many with no success.
Is there a way?

-- 
Bob Peirce, Pittsburgh, PA				  412-471-5320
...!uunet!pitt!investor!rbp			rbp@investor.pgh.pa.us

rbp@investor.pgh.pa.us (Bob Peirce #305) (08/08/90)

I started getting answers back almost before this item went out!

Thanks to everybody who told me to try \e.  This works.  I am
ashamed to say I did not see this in the manual, although I
_THOUGHT_ I had reviewed it carefully.

-- 
Bob Peirce, Pittsburgh, PA				  412-471-5320
...!uunet!pitt!investor!rbp			rbp@investor.pgh.pa.us

jac@paul.rutgers.edu (Jonathan A. Chandross) (08/08/90)

rbp@investor.pgh.pa.us (Bob Peirce #305)
> I have read the manual.  I have experimented with .ec and with
> escaping one back-slash with one to many with no success.
> Is there a way?

You bet.  It's even in the manual.  (Honest!)  Just use:
	\e
this prints the escape character (normally a backslash).  For instance,
	printf("Hello World!\en");
You could also do something evil like:
	\\
in your text, but this is generally a bad idea.


Jonathan A. Chandross
Internet: jac@paul.rutgers.edu
UUCP: rutgers!paul.rutgers.edu!jac

tmoore@coss.Dayton.NCR.COM (Tom Moore) (08/09/90)

Try the escape sequence '\e' to output the current escape character.

-- 
* Tom Moore                NCR Corporation  PCD-6              (513) 445-1373 *
* Consulting Analyst       1700 S. Patterson Blvd.         VOICEplus 622-1373 *
* Network Applications     Dayton, OH 45479          Tom.Moore@Dayton.NCR.COM *

josef@nixpbe.UUCP (Moellers) (08/10/90)

In <1990Aug7.190300.8450@investor.pgh.pa.us> rbp@investor.pgh.pa.us (Bob Peirce #305) writes:

>I have read the manual.  I have experimented with .ec and with
>escaping one back-slash with one to many with no success.
>Is there a way?

The manual (nroff/troff Technical Discussion) sais: 

23. Escape Sequences for Characters, Indicators, and Functions
Section	    Escape	Meaning
Reference   Sequence
:	    :		:
10.1	    \e		Printable version of the current escape character
:	    :		:

--
| Josef Moellers		|	c/o Nixdorf Computer AG	|
|  USA: mollers.pad@nixbur.uucp	|	Abt. PXD-S14		|
| !USA: mollers.pad@nixpbe.uucp	|	Heinz-Nixdorf-Ring	|
| Phone: (+49) 5251 104662	|	D-4790 Paderborn	|

brown@vidiot.UUCP (Vidiot) (08/12/90)

In article <1990Aug7.190300.8450@investor.pgh.pa.us> rbp@investor.pgh.pa.us (Bob Peirce #305) writes:
<I have read the manual.  I have experimented with .ec and with
<escaping one back-slash with one to many with no success.
<Is there a way?

Outside of a macro, ie, in the text file, it is just like you did:  \\
While inside of a macro it is: \\\\  and double that for each macro defined
inside of a macro.  It may actually work as \\ inside of a macro, since you
are not fetching values from a variable.

Without doing anything special to nroff when it starts, the \\ should print
a single \ without a problem.  I use it all the time in troff test.
-- 
      harvard\     att!nicmad\        spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INET:<@spool.cs.wisc.edu,@astroatc:brown@vidiot>

hansen@pegasus.ATT.COM (Tony L. Hansen) (08/18/90)

< From: brown@vidiot.UUCP (Vidiot)
< In article <1990Aug7.190300.8450@investor.pgh.pa.us> rbp@investor.pgh.pa.us (Bob Peirce #305) writes:
<< I have read the manual.  I have experimented with .ec and with escaping
<< one back-slash with one to many with no success. Is there a way?

< Outside of a macro, ie, in the text file, it is just like you did:  \\
< While inside of a macro it is: \\\\  and double that for each macro
< defined inside of a macro.  It may actually work as \\ inside of a macro,
< since you are not fetching values from a variable.

< Without doing anything special to nroff when it starts, the \\ should
< print a single \ without a problem.  I use it all the time in troff test.

There's never a need to use multiple backslashes to get a backslash to
print. Just use \e to print the "current escape character", which is always
the backslash unless the .ec command is issued.

					Tony Hansen
				att!pegasus!hansen, attmail!tony
				    hansen@pegasus.att.com