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

Support macro \cacheMeCode from robust-externalize #80

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jlelong
Copy link
Owner

@jlelong jlelong commented Mar 28, 2024

This is a follow-up on #79 #77.

This PR adds support for \cacheMeCode[options]{code}. Both the content of [] and {} can span over several lines.

@dflvunoooooo @tobiasBora Currently the code part is considered as verbatim. Would it make sense to support embedded language and if so how can it be inferred from the optional argument?

@tobiasBora
Copy link

tobiasBora commented Mar 28, 2024

Thanks a lot! So a few remarks:

  • I use the convention that environments start with upper case letter and command with lower case letters,
  • \CacheMe (or rather \cacheMe) is morally the command version of \begin{CacheMe}, that we decided to keep in LaTeX form as it actually parses the code as LaTeX (removing %…), so I guess it would make sense to do the same for \cacheMe
  • \cacheMeCode[preset options]{code} is indeed the equivalent of \begin{CacheMeCode}{preset options}code\end{CacheMeCode} (or rather will, I wrote it recently and I'll push it soonish once I finish working on a nicer way to work with python & sagemath). But the idea is exactly the same : you can parse the language exactly like in CacheMeCode to print it accordingly.

@jlelong jlelong changed the title Support macro \CacheMe from robust-externalize Support macro \cacheMeCode from robust-externalize Mar 29, 2024
@jlelong
Copy link
Owner Author

jlelong commented Mar 29, 2024

Thanks for the explanations. I fixed the macro name to only consider \cacheMeCode. As for the CacheMe environment, the standard LaTeX grammar can already handle the macro \cacheMe.

I will add the recognition of embedded languages for \cacheMeCode.

jlelong added 4 commits April 11, 2024 08:06
This is required to properly detect the end of the argument.
Probably less important once the content is properly detected as an
embedded language.
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

Successfully merging this pull request may close these issues.

2 participants