canismarko / dungeon-sheets

A tool to create character sheets and GM session notes for Dungeons and Dragons fifth edition (D&D 5e).
https://dungeon-sheets.readthedocs.io/en/latest/
GNU General Public License v3.0
161 stars 66 forks source link

More RPGtex dndtemplate options for the fancy feature pages #165

Closed PJBrs closed 2 weeks ago

PJBrs commented 5 months ago

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 commented 5 months ago

Here examples of unpatched and patched monsters.

Unpatched: gm-session-notes-unpatched.pdf

Patched: gm-session-notes-patched.pdf

PJBrs commented 5 months ago

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 commented 5 months ago

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

image

PJBrs commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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.