I have done some searching already, but did not find anything on the topic and I'm not sure where to even really begin looking for this.
As the title suggests, I was wondering if it was possible to create a tabular
environment using graphics for the borders. I am working on some Dungeons & Dragons-related resources for myself and would like to create a look similar to the one used in the official books.
For reference on what I would like it to look:
There are resources on the unearthed arcana subreddit that provide the graphics for these tables, and just to be clear, I don't intend to get into a discussion on whether or not this is the most efficient way to achieve what I'm looking for, I'm sure something like inDesign would be much better suited for this.
I am mostly curious if something like this can be done in LaTeX, or if I would have to do that as a background image or something similar behind the actual LaTeX table.
Any ideas on the topic are very welcome 🙂
Greetings,
Panic
Some close-ups of the border:
This is also the template image found on the unearthed arcana subreddit (the second one has a transparent background), credit goes to wizards of the coast of course 🙂
Best Answer
Here is a starting point with the great tcolorbox package. It has all the ornaments in black and yellow-greenish lines; the other background graphics could be added the same way if you have enough patience, after you've decided whether, and if so, how, they should adapt to the frame dimensions.
In the examples below, I define a
tcolorbox
skin calledornamented
, a style with the same name that doesskin=ornamented
plus a few other settings (among which the small caps shape for the box title font as in your screenshot), and an environment calledornamentedbox
. This environment outputs atcolorbox
that uses theornamented
style. Theornamentedbox
environment has an optional argument: you can inserttcolorbox
options there, that may override the default settings ofornamentedbox
.Of course, you can put
tabular
arrays, maths, images and whatnot inside theornamentedbox
environment. It's atcolorbox
, after all. :-)I propose two variants of the code that differ in positioning of the decoration lines with respect to the bounding box, and space handling around the box. My preference goes to the second one, because it allows better tuning of vertical spacing inside the box, in my opinion.
Decoration lines (mostly) contained within the bounding box
In this variant, apart from very small details on the left and right sides, we ensure that all decoration rules are inside the bounding box of the
ornamentedbox
(see below for a screenshot where the bounding box is drawn in red). This makes positioning relatively to what lives outside the box easier in general since there is no risk, for instance, of having an overlap with contents located above or below the box—but the most desirable variant ultimately depends on what you want.And here is a screenshot of the first box from the preceding example, with its bounding box in red (made visible thanks to the
show bounding box
option):Detail:
Decoration lines extending beyond the bounding box
In this second variant, the decoration lines extend a bit beyond the bounding box on all sides. This may be useful in some cases (for instance, for a box next to one or more of the page margins, this behavior may be desirable). But without some care, this may obviously cause overlapping with nearby contents. I dealt with this problem by adding skips: these are spaces (horizontal or vertical) that automatically disappear when they occur:
at the beginning or end of a line, for the horizontal kind;
at the beginning or end of a page, for the vertical kind.
Thus, when there is contents next to the box, the skips prevent contents next to the box from overlapping with the ornamental lines; but when the box is against one of the page margins, the corresponding skip disappears and the decorations on this side extend slightly beyond what the margin normally allows (i.e., decorations are allowed to protrude in the margins).
Page 1:
Page 2:
Page 3:
As said, with this variant of the code, all decoration lines intentionally extend a little bit outside the bounding box (image obtained with the
show bounding box
option):Detail:
Note that the skips I mentioned above are located outside the bounding box represented in red (next to it), precisely to tell TeX about the space occupied by the decorations that protrude beyond the bounding box. These skips are automatically discarded by TeX when they would occur at the beginning or end of a line (for horizontal skips) or at the beginning or end of a page (for vertical skips).
Environment for ornamented
tabular
In the previous example, I defined an environment called
ornamentedtabular
that nicely wraps atabular
inside anornamentedbox
and adds a few things such as alternating colors. As shown by the code and screenshots, it allows one to easily obtain a presentation of tables similar to the one in the picture you posted. This environment can also be used with the first variant of theornamentedbox
.