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

Feature request: add support for <..>-arguments of environments #16

Open
buzden opened this issue Mar 6, 2024 · 5 comments
Open

Feature request: add support for <..>-arguments of environments #16

buzden opened this issue Mar 6, 2024 · 5 comments

Comments

@buzden
Copy link

buzden commented Mar 6, 2024

For example, to support generation of

\begin{uncoverenv}<3->
...
\end{uncoverenv}
@chdemko
Copy link
Owner

chdemko commented Mar 13, 2024

That's a good idea. Could it be possible to propose a Pull request ?

@buzden
Copy link
Author

buzden commented Mar 13, 2024

Yes, it could. The question is in the design. What I came with by experimenting is a bit more general solution (TBH, I impelemented it as a lua-script) and it is the following: we could support all types of the arguments in any order the user wishes, so that, say

``` {.env on=whatever}
...
```

translates to

\begin{env}<whatever>
...
\end{env}

and

``` {.env arg=whatever}
...
```

translates to

\begin{env}{whatever}
...
\end{env}

and

``` {.env opt=whatever}
...
```

translates to

\begin{env}[whatever]
...
\end{env}

But any longer combinations are also possible:

``` {.env arg=w1 arg=w2 on=w3 opt=w4}
...
```

translates to

\begin{env}{w1}{w2}<w3>[w4]
...
\end{env}

and etc.

Are you okay with such design?

@chdemko
Copy link
Owner

chdemko commented Mar 19, 2024

I think I'm globally ok but it lacks some features:

``` {#identifier .env arg=w1 arg=w2 on=w3 opt=w4 convert.arg="*italic*" convert.opt="**bold**"}
...
```

should be translates to

\begin{env}{w1}{w2}{\emph{italic}}<w3>[w4][\textbf{bold}]\label{identifier}
...
\end{env}

This is already the case with the title argument.

@chdemko
Copy link
Owner

chdemko commented Mar 19, 2024

The issue is that I use panflute to parse the data and panflute considers attributes as a python dict (without duplicates). See http://scorreia.com/software/panflute/code.html#panflute.elements.Div.

>>> from panflute import convert_text
>>> convert_text("""
... ::: {.env arg=a arg=b}
... :::
... """
... )
[Div(; classes=['env'], attributes={'arg': 'b'})]
>>> 

This supposes to use another way for parsing the JSON produced by pandoc:

  • by parsing the JSON directly (bad idea)
  • by adding some specification in the environment definition:
---
pandoc-latex-environment:
  test:
    classes: [class1, class2]
    args:
      - name: title
        convert: true
      - name: subtitle
        optional: true
      - name: other
---

``` {#identifier .class1 .class2 other="**other**" title="**mytitle**" subtitle="*subtitle*" overlay="1-3"}
...
```

should be converted to:

\begin{test}{\textbf{mytitle}}{**other**}<1-3>[*subtitle*]\label{identifier}
...
\end{test}

@chdemko
Copy link
Owner

chdemko commented Mar 20, 2024

When studying https://texdoc.org/serve/xparse/0, it seems that we should have a clear way to use these LaTeX3 new feature

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

2 participants