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

asy-latex one line processing #436

Open
mdoob opened this issue Mar 11, 2024 · 0 comments
Open

asy-latex one line processing #436

mdoob opened this issue Mar 11, 2024 · 0 comments

Comments

@mdoob
Copy link

mdoob commented Mar 11, 2024

The asy environment used for inline code within a LaTeX document is defined starting on line 244 here: https://github.com/vectorgraphics/asymptote/blob/master/doc/asy-latex.dtx). Lines are read in one at a time until one matches \end{asy}.

The code for doing this:
\gdef\ProcessAsymptoteLine#1^^M{%
\def@tempa{#1}%
{%
\escapechar=-1\relax%
\xdef@tempb{\string\end\string{\CurrentAsymptote\string}}%
}%
\ifx@tempa@tempb%
\edef\next{\endgroup\noexpand\end{\CurrentAsymptote}}%
\else%
\ThisAsymptote{#1}%
\let\next\ProcessAsymptoteLine%
\fi%
\next%
}

The lines in boldface test for the line match.

It appears (naively?) to be pretty easy to extend the definition of this macro to one that it terminates after exactly one line. Why might this be useful?

  1. It could be used within other macros since it does on depend on line breaks.
  2. It is unaffected by an unexpected reformatting.
  3. It would be convenient for small inserts.
  4. One line may have many semicolons 😄.

Any thoughts?

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

1 participant