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

newenvironment with markdown #20

Open
cdupont opened this issue Nov 22, 2017 · 3 comments
Open

newenvironment with markdown #20

cdupont opened this issue Nov 22, 2017 · 3 comments
Labels
latex Related to the LaTeX interface and implementation question

Comments

@cdupont
Copy link

cdupont commented Nov 22, 2017

Hi, and thanks a lot for this package!
I'm trying to define a new environment with markdown:

\newenvironment{todo}
   {\begin{markdown}
   }
   { 
   \end{markdown}
   }

But I got this message:

Runaway argument?
! File ended while scanning use of ^^M.
@Witiko
Copy link
Owner

Witiko commented Nov 22, 2017

Hi. You cannot do that, since when the package encounters \begin{markdown}, it starts scanning for precisely the string \end{markdown} and there is no expansion during this procedure (similar to verbatim and other fragile environments). You can add support as follows:

\newenvironment{todo}
    \todoenv
    \relax

Given the following (slightly tricky) definition of \todoenv:

\begingroup
\catcode`\|=0\catcode`\<=1\catcode`\>=2%
\catcode`\\=12|catcode`|{=12|catcode`|}=12%
|gdef|todoenv<|markdownReadAndConvert<\end{todo}><|end<todo>>>
|endgroup

you can then just use

\begin{todo}
Hello, *world*!
\end{todo}

as you probably indended. This is very similar to how the markdown environment itself is defined in section 3.3.2 of the technical documentation.

@cdupont
Copy link
Author

cdupont commented Nov 22, 2017

Thanks a lot.

@Witiko Witiko closed this as completed Nov 22, 2017
@Witiko Witiko added question latex Related to the LaTeX interface and implementation labels Apr 14, 2018
@Witiko
Copy link
Owner

Witiko commented Apr 9, 2024

We may want to add support for easier use of the markdown LaTeX environment in other LaTeX environments using a similar approach as tabularx:

image

@Witiko Witiko reopened this Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
latex Related to the LaTeX interface and implementation question
Projects
None yet
Development

No branches or pull requests

2 participants