Open TS-CUBED opened 3 months ago
Good point! I will try to look into it when I get time. I think you may try @latexdefine from latexify for that scenario…Actually that doesn’t seem to inline it nice either.
@latexdefine
works nicely here:
```{julia}
md"""
A helium filled stratospheric balloon is designed for an altitude of $(@latexdefine H) with a maximum volume of $(@latexdefine V_max).
The balloon is filled with $(@latexdefine m_He) of helium.
The molar mass of helium is $(@latexdefine M_He).
The balloon itself has a mass of $(@latexdefine m_b) including all the rigging.
"""
Gives me:
![image](https://github.com/co1emi11er2/Handcalcs.jl/assets/52218856/8335542f-a040-484d-863c-a71942d29fd0)
Thank you so much for this package, btw.
I am hopeless with putting numbers into equations and my solutions used to be riddled with wrong results (doesn't really matter if we tell the students that it's the way to the result that carries the marks, not the final result).
So I switched to using Julia notebooks to do the calculations. Which led to two problems:
With this latest change I can define the values in a codeblock and then generate both the question text AND the solution from the same parameters, hopefully leading to correct solutions (finally).
Awesome! Glad it worked. Yeah I think @latexdefine
is the best thing to use for those scenarios. I can maybe try and clean that up eventually, but on the top of my head it seems like it may add a bit of complexity.
Thanks! I am glad it is helping! That is the main goal for me too, just to make it look like math not code. I will also mainly be integrating with quarto. I am hoping that Pluto soon gets quarto integration.
Did you manage to find a solution to the squared variables with units problem? I could just take your solution with dev Latexify
my own fork of Latexify, but I don't think I can convince my colleagues to do that (some of which are starting to adopt my approach to creating teaching material with Quarto*).
*I started doing it with org-mode, but that would have been a lost battle from the start.
I am currently just using the dev Latexify
method, but I do 100% plan to get it into Latexify. I am currently working on a big internal tool that will use Handclacs and Unitful, but I am sort of focusing on getting the overall tool done and working on my computer and then will push to get it working on Latexify.
Maybe I will switch focus and get that working on Latexify. I need to register my own units package anyway (just a package that registers units based on my area of profession to Unitful), so maybe I will do that next. The maintainers of Latexify are sort of busy at the moment though, so that's why I sort of pushed it off.
I want to get this maybe working too:
using Handclacs, StructuralUnits #my units package
@handcalcs begin
b = 5.0ft
h = 120.0inch
area = b*h |> ft^2
end
and it will render like so:
Currently to get this working I have to do something like so and it is not ideal:
@handcalc
does not expand predefined variables.but
@handcalcs
does:In most cases I simply use
@handcalcs
even for single equations, to avoid this issue, but I'd like to use something like:in Quarto, which works if I use:
but since that wraps the equation in an
aligned
environment, it does not flow nicely with the text. There is added whitespace around the equation.