RTF Line separator
Asked Answered
F

5

11

Does someone knows how to insert a horizontal line separator in a RTF file?

Example:

some text


some other text

Footboard answered 18/12, 2009 at 16:41 Comment(0)
M
10

You could use the \dpline commands (See the section on "Drawing Objects" on page 157 in the RTF Spec 1.9.1).

Here's a sample that should do what you want:

{\rtf1
{\pard some text.\par}
{\pard {\*\do\dobxcolumn\dobypara\dodhgt
        \dpline\dpxsize9200\dplinesolid\dplinew30}\par}
{\pard some other text.\par}
}

RTF Output Preview: RTF Output Preview

You customize the line color with \dplineco[rgb], width with \dplinew), line-styles etc.

And if you're interested in RTF, you would find the RTF Pocket Guide helpful -- it is much less boring than the RTF Spec! Specifically, it talks about other ways of drawing a horizontal line.

Meliorism answered 18/12, 2009 at 18:34 Comment(3)
Great! I just bought the book: thank you for this advice witch will be a great help ;)Footboard
@AshutoshMehra this won't render the line for me in OS X TextEdit.App which I had thought was a full-featured RTF editor. Which editor are you folks using? Any idea why I can't produce a line with these commands in my editor?Gala
I have the same problem as @TeXnewbie; macOS's rendering approach doesn't seem to treat this as anything; I just see a blank space.Eriha
V
2

If you just need a simple horizontal rule you can also try this:

{\pard \brdrb \brdrs\brdrw10\brsp20 {\fs4\~}\par \pard}
Virgina answered 1/11, 2012 at 13:53 Comment(1)
what text editor are you using? When I try this in OS X TextEdit.App, the editor does not render anything that looks like a line or horizontal rule.Gala
M
0

Here's code to draw a line at any arbitrary angle:

{\rtf1
{\shp
{\shpinst \shpbxpage \shpbypage \shpleft200 \shptop400 \shpright3000 \shpbottom2000
{\sp{\sn shapeType}{\sv 32}}
}}}

See RTF spec. for 'shapeType' options.

As I begin to learn RTF, it appears that '\do' draw objects are of limited use, and '\shp' is the way to go. For instance, you can only do horizontal lines with \dpline. You can't suppress the rectangle (zero line width) around \dptxbx. Neither \dptxbx nor \dptxbxtext will obey \fittext.

Melvin answered 1/11, 2015 at 14:59 Comment(1)
On macOS, this just renders "shapeType32"Eriha
C
0

I've just successfully made a convincing horizontal rule in Apple's Textedit by: insert a table, set the cols and rows to 1 (change the colour of the border at this point if you want) type a single character (a space) in the cell, select it and open the font palette, set font size to 0.2

Clinometer answered 16/2, 2016 at 16:16 Comment(1)
This was a coding question so your answer is not very relevant, but thank you anyway :-)Footboard
S
0

As a minimalist, you can use centered, underscored spaces:

\par
\pard\qc\ul                          \ulnone\par
\pard\par

If centering is imperfect, you may need to add a non-breaking space \~ as the last space just before \ulnone.

Spiker answered 12/7 at 2:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.