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

\DndInnateSpellLevel does not work with optinal Argument, but works without it. #196

Closed
ghost opened this issue Feb 20, 2019 · 9 comments
Closed

Comments

@ghost
Copy link

ghost commented Feb 20, 2019

Hi, i've loaded the example file in Overleafe after I couldn't compile it without error on my laptop. And I get the same error in both cases.

<argument> \str_if_in:NnTF {fog cloud, rope trick}{,}{\__dnd_caption:nn {\nu... l.129 ...nnateSpellLevel[3]{fog cloud, rope trick}

I've found the issue in ./lib/dndmonster.sty. But I'm unable to fix it, lacking the understanding for latex3.

\ExplSyntaxOn
\NewDocumentCommand {\DndInnateSpellLevel} { O{\innateatwillname} m}
  {
    \smallskip
    \begin{hangingpar}
      \IfInteger{#1}
      {
        \str_if_in:NnTF {#2} {,}
        { \__dnd_caption:nn { \numberperdayeachname } { #1 } }
        { \__dnd_caption:nn { \numberperdayname     } { #1 } }
      }
      {#1}
      :~\DndEmphSpellString{#2}
    \end{hangingpar}
  }

This is my MWE:

\documentclass[letterpaper,10pt,twoside,twocolumn,openany]{dndbook}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{listings}
\lstset{%
  basicstyle=\ttfamily,
  language=[LaTeX]{TeX},
}

\begin{document}
\begin{monsterbox}{Monster Foo}
  \begin{monsteraction}[Innate Spellcasting]
    \DndInnateSpellLevel{misty step} % works fine without optional values
    \DndInnateSpellLevel[1]{identify} % here are the errors
  \end{monsteraction}
\end{monsterbox}
\end{document}

And the output does not look correct either.

screenshot at 2019-02-20 09-31-31

@BrianCriswell
Copy link
Member

BrianCriswell commented Feb 20, 2019

Which version of the dnd module are you using? I seem to remember a bug like that as we were developing the feature. I just compiled your MWE successfully in 0.7.0.

@ghost
Copy link
Author

ghost commented Feb 20, 2019

Version v0.7.0
I downloaded the current version and uploaded it on Overleaf without any changes.

@BrianCriswell
Copy link
Member

Would you please post the full log to a gist and link it here?

Does the example.tex file within the v0.7.0 download compile correctly?

@benwebber
Copy link
Contributor

Overleaf offers TeX Live 2016. The str_if_in:NnTF variants were added in October 2017:

https://github.com/latex3/latex3/blob/83d2792ccf9e1c03b8a06e85c889d442da8e798c/l3kernel/l3str.dtx#L332-L339

This is an older version than I hoped to support, but I don't think we should alienate Overleaf users. It's a very important stepping stone into the LaTeX world.

There are a few different ways we can handle this problem, but they warrant discussion on a separate issue.

@Doibur, to get your document working immediately you can typeset the spells manually:

\begin{hangingpar}
  3/day each: \emph{fog cloud}, \emph{rope trick}
\end{hangingpar}

@BrianCriswell
Copy link
Member

And if you want to be ready for the newer features before we get backwards compatibility sorted, install TeX Live 2018 and use tlmgr to update the packages, but @benwebber's solution will get you off the ground.

@ghost
Copy link
Author

ghost commented Feb 20, 2019

Thanks @benwebber . That helped me much.

@ghost ghost closed this as completed Feb 20, 2019
@Xhark-Blues
Copy link

I did this to make it work in overleaf. Don't know exactly what should be din't but maybe is close enough?

\NewDocumentCommand {\DndInnateSpellLevel} { O{\innateatwillname} m}
  {
    \smallskip
    \begin{hangingpar}
      \IfInteger{#1}
      {
        \IfSubStr{#2}{,}
            {#1 /day~each}
            {#1 /day}
      }
      {#1}
      :~\DndEmphSpellString{#2}
    \end{hangingpar}
  }

@BrianCriswell
Copy link
Member

If the output looks like the books, then you got it right. :)

@Xhark-Blues
Copy link

I think it does, and it works in overleaf 👍 maybe a bit too much interline space, but thats alright, and i guess also easey to fix

This issue was closed.
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

No branches or pull requests

3 participants