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

Add macro for latexifying one-liner functions and add external rendering. #100

Merged
merged 14 commits into from
Jun 5, 2020

Conversation

korsbo
Copy link
Owner

@korsbo korsbo commented Jun 4, 2020

Poor practice, but this PR contains two separate new features.

One is the exported function render which tries to render a LaTeXString using lualatex and open the result in an external viewer. Useful for rendering things when in the REPL.

The other is a macro @latexify which can be used to directly latexify one-liner Julia functions.

julia> @latexify f(x, y=2) = x^2 + y
$\mathrm{f}\left( x, y = 2 \right) = x^{2} + y$

This macro call will also define f as expected.

No documentation or test yet.

@coveralls
Copy link

coveralls commented Jun 4, 2020

Coverage Status

Coverage decreased (-2.3%) to 76.134% when pulling af5cf56 on render into fb34189 on master.

@codecov
Copy link

codecov bot commented Jun 4, 2020

Codecov Report

Merging #100 into master will decrease coverage by 2.20%.
The diff coverage is 30.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
- Coverage   79.29%   77.09%   -2.21%     
==========================================
  Files          22       23       +1     
  Lines         512      537      +25     
==========================================
+ Hits          406      414       +8     
- Misses        106      123      +17     
Impacted Files Coverage Δ
src/Latexify.jl 75.00% <ø> (ø)
src/utils.jl 0.00% <0.00%> (ø)
src/latexoperation.jl 92.77% <100.00%> (+1.74%) ⬆️
src/macros.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb34189...af5cf56. Read the comment docs.

@korsbo
Copy link
Owner Author

korsbo commented Jun 5, 2020

I disabled execution from @latexify. This macro now just treats the argument as an expression for latexification, without executing that expression.

The new macro @latexrun will first execute the expression and then latexify it.

Both should work for some simple maths-looking functions like f(x; y=1) = x + y.

@korsbo
Copy link
Owner Author

korsbo commented Jun 5, 2020

Although the approach is different than I imagined, I would say that this PR closes #28.

@korsbo korsbo changed the title Add macro for latexifying one-liner functions and add REPL rendering. Add macro for latexifying one-liner functions and add external rendering. Jun 5, 2020
@korsbo korsbo merged commit 8205f13 into master Jun 5, 2020
@korsbo korsbo deleted the render branch June 5, 2020 13:14
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