discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* \u and \d
@ 2013-12-06  6:58 Anthony J. Bentley
  2013-12-25 23:04 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony J. Bentley @ 2013-12-06  6:58 UTC (permalink / raw)
  To: discuss

\utest\d

Displays "test" in groff. In mandoc, it displays "utestd". I have no
idea what special formatting these escapes are meant to trigger (maybe
superscripts via 'u'p and 'd'own?), but they should be at least
ignored if they aren't implemented.

An example appears in pdf2djvu.1, generated from this (yes, more Docbook crap):
https://code.google.com/p/pdf2djvu/source/browse/doc/pdf2djvu.xml

It has some sort of footnotes system, such that this:

<ulink url='http://code.google.com/p/pdf2djvu/issues/'>the issue tracker</ulink>

generates this:

\m[blue]\fBthe issue tracker\fR\m[]\&\s-2\u[5]\d\s+2\&

-- 
Anthony J. Bentley
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: \u and \d
  2013-12-06  6:58 \u and \d Anthony J. Bentley
@ 2013-12-25 23:04 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2013-12-25 23:04 UTC (permalink / raw)
  To: Anthony J. Bentley; +Cc: discuss

Hi Anthony,

Anthony J. Bentley wrote on Thu, Dec 05, 2013 at 11:58:55PM -0700:

> \utest\d
> 
> Displays "test" in groff. In mandoc, it displays "utestd". I have no
> idea what special formatting these escapes are meant to trigger (maybe
> superscripts via 'u'p and 'd'own?),

Yes, they are shorthands for \v'0.5v' and \v'-0.5v', respectively,
i.e. moving half a line up or down; not necessarily for super- and
subscripts, though: if you want to change the font size, you have
to do that in addition to \u and \d, as in the example you cite
below:

> \m[blue]\fBthe issue tracker\fR\m[]\&\s-2\u[5]\d\s+2\&

They are documented in the Ossanna/Kernighan/Ritter Heirloom Troff Manual

  http://heirloom.sourceforge.net/doctools/troff.pdf

and also in the Groff Manual,

  http://www.gnu.org/software/groff/manual/html_node/Page-Motions.html

> but they should be at least ignored if they aren't implemented.

Sure, they cannot be implemented for -Tascii, but they can be ignored.

I just committed the following patch to bsd.lv and OpenBSD.

Thanks for reporting,
  Ingo


Date: Wed, 25 Dec 2013 17:45:33 -0500 (EST)
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Parse and ignore the roff(7) escape sequences \d ...

Log Message:
-----------
Parse and ignore the roff(7) escape sequences \d (move half line down)
und \u (move half line up).  Found by bentley@ in some DocBook crap.

Modified Files:
--------------
    mdocml:
        mandoc.c

Revision Data
-------------
Index: mandoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -Lmandoc.c -Lmandoc.c -u -p -r1.71 -r1.72
--- mandoc.c
+++ mandoc.c
@@ -102,6 +102,14 @@ mandoc_escape(const char const **end, co
 		break;
 
 	/*
+	 * Escapes taking no arguments at all.
+	 */
+	case ('d'):
+		/* FALLTHROUGH */
+	case ('u'):
+		return(ESCAPE_IGNORE);
+
+	/*
 	 * The \z escape is supposed to output the following
 	 * character without advancing the cursor position.  
 	 * Since we are mostly dealing with terminal mode,
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-25 23:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-06  6:58 \u and \d Anthony J. Bentley
2013-12-25 23:04 ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).