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
164 stars 67 forks source link

latex output #92

Open matsavage opened 3 years ago

matsavage commented 3 years ago

Hey, I came across this package a while ago and was really impressed,

I spent a while working on a LaTeX character sheet template, and was wondering if you'd be interested in a PR to build outputs from your package for the template I built.

https://github.com/matsavage/DND-5e-LaTeX-Character-Sheet-Template

Can't figure out how to get in touch with you other than here.

canismarko commented 3 years ago

Thanks for reaching out. Yeah, I'd definitely be interested, your character sheets look really nice.

One of the struggles I've had with the fillable-PDF route I'm using now is that I can't figure out how to get rich-text into the PDF fields, and this would be a fix to that, too: https://github.com/canismarko/dungeon-sheets/issues/3

For now, I think it's probably safest to add a new command line option for turning on your template. If it's stable, and works better than the fillable PDF route, I'd be interested in making it the default. Might also take care of this issue too: https://github.com/canismarko/dungeon-sheets/issues/75

FYI: I already have an option for using the same DND-5e-LaTeX-Template through the --fancy option.

matsavage commented 3 years ago

@Tim-Jackins https://github.com/matsavage/DND-5e-LaTeX-Character-Sheet-Template/issues/7#issuecomment-862646861

Tim-Jackins commented 3 years ago

Hello! I'm in the process of jinja-ifying the wonderful character sheet created by @matsavage so it can be rendered by this package.

matsavage commented 3 years ago

I had the original intention of making it more like a LaTeX module, so each page could be dropped in like the monsterboxes etc in that PR I did for this project, unsure about adding dependences etc in LaTeX

Tim-Jackins commented 3 years ago

Yeah, my hope was just to get the character files in here with jinja that uses the character object to build. As far as rich text goes do we have any intention to allow users to write the longer section descriptions (other features and the equipment section) with minimal markdown (ie translate text here to \textbf{text here})?

matsavage commented 3 years ago

I believe that's already handled by the markdown syntax used in this library already

Tim-Jackins commented 3 years ago

Thanks for the info. I really need to look more into this package...

canismarko commented 3 years ago

Sorry for the slow response. Thanks for working on this. I was looking into ways to bundle the latex dependencies in with the package, but I couldn't find a way that doesn't involve actually installing them into texlive or whatever. If you have any ideas please let me know.

The ability to parse the rst into proper latex should be all there now (https://github.com/canismarko/dungeon-sheets/issues/70). It uses the rst_to_latex function in latex.py. The handling of headings is a little screwy still, since it doesn't quite know how to parse different heading levels from rst to latex.

bw-mutley commented 3 years ago

Hi there, I just want to know the state of the art regarding this. @Tim-Jackins , please let me know if you have a template running already. I've already decided to start using this template on my own sheets - it is really beautiful by the way - and I am willing to provide any help if needed. The character sheet part is straighfoward to adapt, I just see the spells list part would have to be worked a bit in order to get the corresponding fields from the docstrings. ==EDIT== NVM, the spells part is also easy. @Tim-Jackins , just let me know how is your template so I can have a somewhat 'stardarized' form.

@canismarko , @matsavage thank you and congratulations for your work!

matsavage commented 3 years ago

@canismarko sorry this is coming slow, I totally missed that comment from about 3 weeks ago. This point was where I sort of got stuck on this too, I think the options are either:

I'm really not sure which of these is preferable

canismarko commented 3 years ago

If you can make the last option work, I think that would be the easiest for people using dungeonsheets since there's no need to worry about texmf or installing extra latex packages. I tried this with the D&D latex template (https://github.com/rpgtex/DND-5e-LaTeX-Template#project-install-using-texinputs), though and couldn't get it to work.

matsavage commented 3 years ago

I'll try and have a look over the weekend with the submodule route, I think something just needs to be done with working directories or environment variables

On a linux environment with the DND template installed in examples/DND-5e-LaTeX-Template the following command worked for me: TEXINPUTS=".:./DND-5e-LaTeX-Template:$TEXINPUTS" pdflatex wizard2_features.tex

Therefore I think the following course of action will work:

This should then let LateX know where the required classes are and then work as expected

Edit: not 100% on how this will work on windows/mac however or if you install the module from pip Edit2: looks like pip does support this https://github.com/pypa/pip/pull/577

Tim-Jackins commented 3 years ago

@bw-mutley My template is unfinished. I'm hoping to finish the back story page soon but work has picked up. I think the backstory page I have so far is enough for you to get started, check it out here. Let me know if you have more questions and I'll try to be more prompt with my reply!

matsavage commented 3 years ago

@canismarko I got this working in the following PR https://github.com/canismarko/dungeon-sheets/pull/103

If you can validate that this works with pypi/pip etc, I'm happy to build out the template files, which should be able to remove the texmf etc dependancies, but as it stands, this should remove the need to install the template separately

The following worked for me:

git clone git@github.com:matsavage/dungeon-sheets.git
cd dungeon-sheets

git checkout latex_environment
git submodule init
git submodule update

python3 -m venv py37
source py37/bin/activate

pip3 install .

makesheets --fancy example/rogue2.py

Which resulted in the rogue2 template typeset in the fancy mode

Tim-Jackins commented 3 years ago

@bw-mutley My template is finished and can be found here

bw-mutley commented 3 years ago

Hi @Tim-Jackins , thanks for the reply. The link you provided is going to a non-Jinjafied template (dagmar.tex), is that correct? Should I work from there? (no problem at all...)

Tim-Jackins commented 3 years ago

@bw-mutley Sorry for the confusion! Yes the template is not jinja-fied I just finished the page rendering in xelatex. I'm happy to do the jinja-fication but my schedule is busy if you think you can do it sooner.

canismarko commented 3 years ago

Thanks, everyone, and thanks for your patience with my slow reply times (I've been working 16 hour shifts 7 days per week at work recently). I got @matsavage's PR merged, with a small tweak. I bumped the version to 0.16.1 and verified that a pip install (from pypi) into a clean conda environment will build with the -F flag. Looking forward to seeing if the character sheets can work this way too.

bw-mutley commented 3 years ago

hi there @canismarko , this merge mean @matsavage 's template is already working with dungeonsheets? I was jinjafying it last night, I am half way through. Also, in the process of reading the code, I've come with some enhancement proposals related to the way the sheet is rendered. I am just unsure where should I touch, as it would mean to change some basic classes like the character class. As an option, I could create a separate module inheriting whataver I needed from yours.

Aside from all this, I have found possible fixes to some small issues listed here, like the proper hit die summing up for multiclass.

Please give me some advice, because I am brand new to to colaborating in github. Thanks for your attention.

matsavage commented 3 years ago

@canismarko i don’t envy those working hours. Reminds me of national facility times myself.

@bw-mutley it means I have to approve @Tim-Jackins changes to my repo to include the middle character sheet page, and then raise a PR to include it in this repo, alongside your jinja template or if you raise a PR to your template I can add the work for the submodule in there.

Maybe best to just have one PR for the templates and then another to fix those other changes you have found? I’m sure there will be some after the template to remove elements that this approach streamlines down the line?

Great to see this all coming together!

matsavage commented 3 years ago

I may be getting ahead of things, but I sort of envisage 3 output modes:

With a flag for with/without features pages for the final 2 options.

Would also be great to get character portraits in the latex version

bw-mutley commented 3 years ago

@bw-mutley it means I have to approve @Tim-Jackins changes to my repo to include the middle character sheet page, and then raise a PR to include it in this repo, alongside your jinja template or if you raise a PR to your template I can add the work for the submodule in there.

Maybe best to just have one PR for the templates and then another to fix those other changes you have found? I’m sure there will be some after the template to remove elements that this approach streamlines down the line?

Great to see this all coming together!

Thanks, for the reply, Mat. I was a bit lost about the best approach since I would need to bridge the works of you and Mark. I will do the following:

  1. Finish the jinjafyied version of your template;
  2. Write a compatibility module to use it with dungeonsheets;
  3. PR them to your repo;
  4. Work on dungeonsheets fixes along the way and PR later;
  5. Write a final version of changes in dungeonsheets to include your template as an optional form and propose a PR to Mark.
matsavage commented 3 years ago

@bw-mutley i think 3 should be a PR against this repo, but that we’ll both have something to contribute to it, so maybe you’ll have fork this repo, add the jinja template, then I can raise a PR to add the template import then you raise a PR here with both of our changes?

github seems to make this harder because of user permissions?

matsavage commented 3 years ago

@bw-mutley or you could just follow the outline here to pull my sheets into this project, that’s all I was going to do

https://github.com/canismarko/dungeon-sheets/pull/103

bw-mutley commented 3 years ago

Hey Mat, I think github makes things easier, it is just me who must to get along :)

or you could just follow the outline here to pull my sheets into this project

Thats what I was trying to do, but since you added this suggestion, I guess I didn't understand well.

you’ll have fork this repo, add the jinja template, then I can raise a PR to add the template import then you raise a PR here with both of our changes

I will follow this option then, seens more clear to me. In this case I would add the changes to the fork I've made from this repo and wait for you to raise the PR before adding my last two changes, did I get it right?

matsavage commented 3 years ago

@bw-mutley sounds good. Let me know when you’re done and I’ll get to it 👍

matsavage commented 3 years ago

@bw-mutley I have gotten quite a lot of the way along with this today, the main work being converting my latex template to be a class so that it can be imported properly, I am still coming across a couple of issues, namely:

druid1.pdf

changes here: https://github.com/matsavage/dungeon-sheets/tree/latex_template

bw-mutley commented 3 years ago

hi there, @matsavage . I was circunventing this path problem using os.chdir to your template directory just before compilation. I don't think there will be repeated work, it won't be hard to adapt to your new files.

canismarko commented 3 years ago

Sorry for the delay. I finally had time to look at @bw-mutley's PR. Thanks for all the hard work. I added a command line option "-T" to use the template. I actually can't use the template on my computer since I don't have Kalam font installed, but since it gets to that point I'm assuming the rest of it works okay.

bw-mutley commented 3 years ago

Glad to be of help!

matsavage commented 3 years ago

That Kalam font issue is a path problem, I’ve included it in my repo but couldn’t get it working when I had my repo included as a submodule. Not 100% sure on what to do to solve this problem, I like the sheet text to be a handwriting font, but all of the ones included in latex aren’t the nicest.

Sent from my iPhone

On 1 Oct 2021, at 21:34, bw-mutley @.***> wrote:

 Glad to be of help!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.