Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More RPGtex dndtemplate options for the fancy feature pages #165

Merged
merged 5 commits into from
Aug 22, 2024

Conversation

PJBrs
Copy link
Contributor

@PJBrs PJBrs commented Mar 13, 2024

This PR aims to make full use of all latex formatting options in the RPGtex latex dnd style. One patch switches the tables in the fancy pages over to the dndtable format. The other adds a jinja filter to format monsters completely according to the rpgtex monster format.

If needed, I can share two pdfs with "before" and "after" that showcase the changes.

@PJBrs
Copy link
Contributor Author

PJBrs commented Mar 22, 2024

Here examples of unpatched and patched monsters.

Unpatched:
gm-session-notes-unpatched.pdf

Patched:
gm-session-notes-patched.pdf

@PJBrs
Copy link
Contributor Author

PJBrs commented Mar 23, 2024

The latex output for monsters had a small bug (invisible though), and it included loads of spurious newlines. My latest force-push fixes that.

@PJBrs
Copy link
Contributor Author

PJBrs commented Mar 23, 2024

... and before and after examples of some tables, one with and one without table header:
image

image

@PJBrs
Copy link
Contributor Author

PJBrs commented May 20, 2024

I've reflected some more on these patches. It seems to me that there's one single risk in switching to dndtable, that is, under the hoodit uses the tabularx environment instead of supertabular, and supertabular supports multi-page tables, which tabularx doesn't... @canismarko is that a problem for you here?

In the meantime, I'm going to find out whether I can fix that with the xltabular environment.

========= EDIT ===========

Well, this is very convoluted, I believe. The xltabular format will fail in multicolumn mode. The real solution would be to switch to the tabularray package, format it the way we want it, and not use the RPGtex dndtable at all. Then again, no tables appear to exist in dungeonsheets that exceed an entire page, and to be on the safe side, I could disable the dndtable in the gm-notes... Please let me know!

@PJBrs
Copy link
Contributor Author

PJBrs commented May 26, 2024

I've given this some more reflection. Upon further inspection, I noticed that dungeonsheets doesn't use multipage tables at all, not in fancy pages or in regular latex output. so this PR doesn't not seem to reduce any functionality. Indeed, it might even be possible to enable multipage tables with some further effort

========= EDIT ===========

And I was wrong, the gm-pages don't use multipage tables, but the character files do. Then again, I just found out how to convert DndTable to supertabular, applied it to the gm-pages, and succeeded in generating a huge, multi-page monstertable. In other words, I can improve upon this PR a bit.

@PJBrs
Copy link
Contributor Author

PJBrs commented Jun 5, 2024

Improved this PR... I took the DndTable environment from the RPGTeX latex style and reimplemented it using supertabular* instead of tabularx. As a consequence, fancy-themed tables now have the same technical characteristics as the non-fancy feature pages (that is, multicolumn, multipage tables), which also use supertabular. As a bonus, I added code to stretch the tables to exactly the width of one column, just as intended.

The last patch is still the same, it uses all monster box styling options available, so that, for instance, the "Actions" title in a monsterbox is a real formatted title, and not just "# Actions," as it was.

In sum, this PR finishes the implementation of all available dnd-style theming to the fancy latex feature pages. I'll admit that the monster formatting patch might look a bit hairy, but the proof of the pudding is in the eating, and above I have included one file with all available monsters, and they all look fine :-)

@PJBrs PJBrs marked this pull request as draft June 11, 2024 12:19
@PJBrs PJBrs force-pushed the latex-dnd-ified branch 3 times, most recently from 061fdd2 to d8ec6df Compare June 15, 2024 07:11
@PJBrs PJBrs marked this pull request as ready for review June 15, 2024 07:39
@PJBrs
Copy link
Contributor Author

PJBrs commented Jun 15, 2024

Did small further tweaks to this PR. I did some regular expression substitutions in python that would have been nicer in latex, but that was beyond my competencies. As far as I'm concerned, this is ready for review.

New dnd-styled table format based on the DndTable
environment from the RPGTeX: DndLongTable.

This patch does not change any formatting, but
seperates a table format from the RPGTeX dndtemplate
so that we can change the underlying latex table
type into something that supports both multicolumn
and multipage tables.

Main consideration: The non-fancy latex table type
we use is supertabular, which supports both multipage
and multicolumn pages (longtable doesn't support
multicolumn). The DndTable environment uses tabularx
under the hood, which doesn't do that. The
DndLongTable environment introduced in this patch
looks just like the DndTable environment but uses
supertabular under the hood.

Differences between DndTable and DndLongTable:
DndTable                 DndLongTable
Uses tabularx            Uses supertabular
Limited to one page      Multipage, multicolumn
Supports X column        Does not support X column
First row bold face      First row no bold face

The DndLongTable format has two options. First,
like DndTable, you can set header=<header> to
add a table caption. Second, you can set
firsthead=<firsthead> to denote the column heads
intended to appear on the first page. This option
mostly helps preventing the first row to end up
on a separate page when a table starts very close
to the bottom of a page.

By using supertabular, the DndLongTable environment
makes it possible to bring the table of fancy pages
at feature parity with the tables in the regular,
while making it possible to fully keep to the style
of RPGTeX Latex.
Dungeonsheets uses rst-to-latex to generate latex text.
For tables, rst-to-latex uses the latex supertabular
format. However, the RPGTeX latex style's DndTable
environment, as well as the DndLongTable environment
that we introduced, is not quite compatible with
supertabular. In particular, table headings result
in latex errors.

This patch modifies the rst-to-latex output so that it
generates a correct table header for the DndLongTable
environment. It also correctly sets the first row
for multipage tables.

The resulting tables are all slightly more compact
than the regular supertabular tables, and they look
better :-)

This patch only uses DndLongTable for the fancy sheets;
regular feature pages keep using the supertabular
output in order for them not to depend on the RPGTeX
latex style.
This patch changes the gm pages to use our internal
DndLongTable of the DndTable, instead of the one in the
RPGTeX dnd latex style.

This patch only uses DndLongTable for the fancy sheets;
regular feature pages keep using the supertabular
output in order for them not to depend on the RPGTeX
latex style.
In the RPGTeX dnd style, dnd tables are intended to be
exactly as wide as the text column. This patch takes
the column widths as calculated by docutils and
stretches all columns so that the resulting table
is exactly one column wide.
When using the fancy feature pages, this patch changes the layout
of the text in the monster block. The patch adds a jinja filter to
parse the monster.__doc__ info and formats that info accordingly.
@canismarko canismarko merged commit 5c4e657 into canismarko:master Aug 22, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants