@gdalle
Here is an exemple of code:
\begin {jllisting}[caption={Computation of the spin-lattice relaxation time. The case of 1H NMR}, label=lis:relaxation_time]
"""
This program describes the NMR spin-lattice relaxation kinetics
of a 1H spin system.
A comparison is made between the analytical solution and a
numerical solution using a Tsits5() solver.
"""
using DifferentialEquations, Plots
#------------------------ data (S.I. units) ------------------------
t1 = 0.92 # relaxation time (s)
u0 = -1.0 # initial normalized value of H0
tspan = (0.0,5.0) # time scale (s)
#------------------------ analytical solution ----------------
equation(u,p,t) = (1/t1)*(1.0-u)
#------------------------ numerical resolution ---------------
probleme = ODEProblem(equation,u0,tspan)
solution = solve(probleme, Tsit5(), reltol=1e-8, abstol=1e-8)
#------------------------ graphs -----------------------------
plot(solution)
plot!(solution.t, t->1.0-(2.0*exp(-t/t1)))
savefig("relaxation_T1-1HRMN_2.pdf")
\end{jllisting}
So, I would like to have ¹H (instead of 1H)
Ditto for t₁ (instead of t1) and u₀
In the resolution of Schrödinger equation, I would like to obtain ψ . Indeed if I copy ψ from the REPL in the jlcode such as:
\begin {jllisting}[caption={Resolution of the 1D Schrödinger equation.}, label=lis:schrodinger_1D]
using OrdinaryDiffEq, Plots
# Parameters (a.u. = arbitrary units)
E = 9.90
# Conditions initiales
x0 = [0.0] # value of ψ à x = 0.0 (=-l/2)
dx0 = [1.0] # valeur de dψ à x = 0.0 (=-l/2)
tspan = (-0.5, 0.5) # x scale (a.U.) from -0.5 to +0.5
# Problem definition
function schrodingerbox1D(ddψ,dψ,ψ,E,t)
ddψ .= -E * ψ
end
# Passing to the solver
prob = SecondOrderODEProblem(schrodingerbox1D,dx0,x0,tspan,E)
sol = solve(prob, DPRKN6())
#Graphs
plot(sol, vars=[2], linewidth=2, xaxis = "x (u.a)",
yaxis = "ψ(x)", framestyle = :box,
label = "1st pair solution")
savefig("schrodinger_1D_1st_pair_sol.pdf")
\end{jllisting}
I obtain an error:
LaTeX command for ψ cannot be found
Here I suppose it is a problem of encoding caracters.
With Listings I could use “escape” characters such as \$\_0$ (to obtain a subscript.). With jlcode I don’t know how to proceeed with possible “escape” characters even though the manual shows plenty of nice possibilities of square root, superscript, subscript, Greek letters, special characters, etc.