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

Completion file (cwl) for dndbook #364

Open
xrogaan opened this issue Dec 16, 2024 · 6 comments
Open

Completion file (cwl) for dndbook #364

xrogaan opened this issue Dec 16, 2024 · 6 comments
Labels

Comments

@xrogaan
Copy link

xrogaan commented Dec 16, 2024

I discovered the latex editor TeXstudio, which is quite good. One of its feature is completion, which helps tremendously while writing latex. (More on that.) Thus I created a document to that effect, see in the linked gist. It was written against a modified DND package, which I needed to do in order to write for Pathfinder. The major changes are in the keys for the various elements of the monster table. I had to reintroduce DMD, BAB, and others stuff. The DndMonster environment isn't properly setup either, mostly because I got rid of the floating aspect of the table. Would put one monster per page, couldn't figure it out, so it is setup to fill a column instead.

dndbook.cwl: https://gist.github.com/xrogaan/6b9f29f19110a8e0f0a68012b4714d1e

The massive list of #include: is from TeXstudio and its automated generation. TeXstudio parse sty files for commands, but failed totally for this package... Except for the dependencies detection. Not sure if it is needed, so I left it as is.

I do not know if it is worth creating a PR for the inclusion of the file. If I did, I would need to properly retrofit in order to follow the current commands. On the other hand, this is a neat resource to have which I wish to share. Could you advise on the proper path to take?

@BrianCriswell
Copy link
Member

Interesting. Since people can generate the cwl within TeXstudio as needed, I don't think it needs to be included in this project.

I personally use VS Code with LaTeX Workshop, Code Spell Checker, and Editor Config. There is some code completion, but possibly not as much as you are experiencing.

@xrogaan
Copy link
Author

xrogaan commented Dec 17, 2024

Since people can generate the cwl within TeXstudio as needed

It didn't work for me, TeXstudio couldn't find any command for dndbook. I had to learn the cwl language and write all the commands, which wasn't obvious :P . There are still some hickups I need to figure out, like the labels.

I didn't understand the options thing for \DndAreaRef:

% Functions to reference a label
\NewDocumentCommand {\DndAreaRef} { o m }
{
\group_begin:
\keys_set:nn { dnd / areas } {#1} % Temp set keys to reference other regions
#2 ~ ( \pageabbreviationname\ \pageref { \l__dnd_region_tl \l__dnd_area_label_tl : #2 } )
\group_end:
}

So when I use that command, the options bit needs to be included but remains empty.

I personally use VS Code with LaTeX Workshop

I used emacs, which is a terrific editor. But it doesn't beat a purposefully crafted editor for latex.

@BrianCriswell
Copy link
Member

Hmm. It looks like TXS is not autogenerating because there is not a \usepackage command.

You could try generating the file by temporarily using the package version of the class.
https://github.com/rpgtex/DND-5e-LaTeX-Template#package

@BrianCriswell
Copy link
Member

I didn't understand the options thing for \DndAreaRef:

% Functions to reference a label
\NewDocumentCommand {\DndAreaRef} { o m }
{
\group_begin:
\keys_set:nn { dnd / areas } {#1} % Temp set keys to reference other regions
#2 ~ ( \pageabbreviationname\ \pageref { \l__dnd_region_tl \l__dnd_area_label_tl : #2 } )
\group_end:
}

So when I use that command, the options bit needs to be included but remains empty.

\DndAreaRef references an area created with \DndArea. The optional argument is for referencing an area in a different region.

@xrogaan
Copy link
Author

xrogaan commented Dec 18, 2024

You could try generating the file by temporarily using the package version of the class.

Well, I wrote the document so I won't do that ;)

\DndAreaRef references an area created with \DndArea. The optional argument is for referencing an area in a different region.

I'm still confused by that. \DndAreaRef does not work if I don't write it in this fashion: \DndAreaRef[]{label}. The log complains about an error:

! LaTeX Error: The key 'dnd/areas/-NoValue-' is unknown and is being ignored.

For immediate help type H <return>.
 ...                                              
                                                  
l.218 \DndAreaRef{TODO room 20}
                                

The module 'dnd/areas' does not have a key called 'dnd/areas/-NoValue-'.
Check that you have spelled the key name correctly.

@BrianCriswell
Copy link
Member

It's complaining that the optional argument was not supplied. For the time being, you will have to supply a value there to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants