## LaTeX forum ⇒ Text Formatting ⇒ How to typeset double rule with text interrupting it? Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
user49915
Posts: 78
Joined: Wed Apr 17, 2019 12:51 pm

### How to typeset double rule with text interrupting it?

Let's assume we have the following junk to typeset (the right-hand side is not seen here):

Original
TII3.png (29.27 KiB) Viewed 1814 times

Here is what I tried so far:

\documentclass{article}\usepackage[USenglish,ngerman]{babel}%%% The main language is German\usepackage{tabularx}\usepackage{lipsum}\usepackage{calc}\usepackage{hhline}\pagestyle{empty}\begin{document}\lipsum[1]\\ \noindent%====\textsf{TII3}\leaders\hbox{=}\hfill\foreignlanguage{USenglish}{timed}====\strut\\\begin{tabular}{@{}|p{\textwidth-1.35em}|@{}}  %	\hhline{|=|}\\[-2.6ex]%%% Well, we need some text inside the double ruler.  \begin{tabular}{@{}l@{\ \ }l@{}l@{\ }l@{}}    \textsf{\textbf{in}} &$$z'$$&$$\colon$$&\textsf{T3}\\    \textsf{\textbf{out}} &$$z$$&$$\colon$$&\textsf{T3}  \end{tabular}\\  \hline\\[-2.2ex] $$\bar{z} = \bar{z'}$$\\ \hline\end{tabular}\\\\ \lipsum[2]\end{document}

And here is the result:
My attempts
file.png (366.15 KiB) Viewed 1814 times

1. Any idea how to typeset the header
╒═══TII3════...════timed═══╕

using a double ruler in the style of hhline, i.e., such that it attaches to the vertical lines of the table, and such that it doesn't look as if it were typed on a 1950's typewriter? Of course, one can use {xe|lua}latex and Unicode box drawings characters, but it would not work with pdflatex, and one would have to use a monospace alphabet and drop tabular anyway.

2. Any idea how to get rid of the ad-hoc width 1.35 em of the rulers and replace it by something automatically computed?

Last edited by user49915 on Mon Nov 18, 2019 2:51 pm, edited 1 time in total.

rais
Posts: 270
Joined: Sun Nov 16, 2014 8:51 pm
perhaps s.th. like this will do:

Going the hhline way, you'd still need to either push the text over the double rule or the double rules to the same vertical position as your text. Both sounded messy to me.

KR
Rainer

user49915
Posts: 78
Joined: Wed Apr 17, 2019 12:51 pm
rais wrote:perhaps s.th. like this will do: [...]

Thank you. Your code gives me this:
mwe1.png (364.5 KiB) Viewed 1741 times

In particular, the double line is unconnected to the rest of the table frame. Any idea of how to connect it?

rais
Posts: 270
Joined: Sun Nov 16, 2014 8:51 pm

looks promising.
Not sure why my width calculation for the outer tabular was off, though.

The newly created \orule creates a vertical rule with the same thickness as the tabular's rules (\arrayrulewidth) and shifts everything that would protrude above the upper line of the double rule below the base line. What is shifted below the base line is hidden from LaTeX (the second [0pt] argument for the \raisebox command takes care of that), so that LaTeX won't leave any space between the \orule and the following line.
Of course, the two lines generated by those \orule commands should match those outer lines from the tabular; OTOH if you lower or widen the outer p{} specification, you can see how far those lines overlap

KR
Rainer

user49915
Posts: 78
Joined: Wed Apr 17, 2019 12:51 pm
rais wrote:The newly created \orule creates a vertical rule with the same thickness as the tabular's rules (\arrayrulewidth) and shifts everything that would protrude above the upper line of the double rule below the base line. What is shifted below the base line is hidden from LaTeX (the second [0pt] argument for the \raisebox command takes care of that), so that LaTeX won't leave any space between the \orule and the following line.
Of course, the two lines generated by those \orule commands should match those outer lines from the tabular; OTOH if you lower or widen the outer p{} specification, you can see how far those lines overlap

If you omit centering and introduce \\ instead of a new para inside, you'll see overlapping, too. Artifacts start appearing only at magnification 2000%. One also does need \nopagebreak after the second \orule to keep the table on one page.
Last edited by user49915 on Tue Nov 19, 2019 2:47 pm, edited 2 times in total.

Johannes_B
Site Moderator
Posts: 4173
Joined: Thu Nov 01, 2012 4:08 pm
Double backslash and noindent is certainly wrong. Dunno what you are doing, but it can't be a solution.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

user49915
Posts: 78
Joined: Wed Apr 17, 2019 12:51 pm
Johannes_B wrote:Double backslash and noindent is certainly wrong. Dunno what you are doing, but it can't be a solution.

You are right. I meant


Here, the center environment is dropped, and you start seeing the overlapping.

user49915
Posts: 78
Joined: Wed Apr 17, 2019 12:51 pm
rais wrote:looks promising

Unfortunately, it breaks if you use the package tabularx (which is not uncommon in large monographs). The input

produces
mwe.png (24.49 KiB) Viewed 1694 times

The right border is not a single line segment, but you see an overlapping of a line segment from above and a line segment from below:
screenshot.png (1.85 KiB) Viewed 1678 times

Any help? (In the worst case, via \@ifpackageloaded.)

rais
Posts: 270
Joined: Sun Nov 16, 2014 8:51 pm
well, if tabularx is needed, try

The stuff marked `just for demo' I just added to verify---or falsify---if the line with the double rules stays within text body's limits.

KR
Rainer

user49915
Posts: 78
Joined: Wed Apr 17, 2019 12:51 pm
rais wrote:well, if tabularx is needed, try

Thanks a lot, rais! You could add \nopagebreak right after the second \orule, but I think it's good enough now. For your information, that's how the left overlap looks like in large magnification in evince after compiling with pdflatex:
screenshot.png (181 Bytes) Viewed 1624 times

The right overlap is similar.

### Who is online

Users browsing this forum: Baidu [Spider] and 1 guest