Variable naming syntax
CalcTree variables use custom syntax that let you create variables that work as functional calculations (in 'code-friendly' form) while displaying also rendering as clean mathematical notation. This system uses underscores and special keywords to control subscripts, superscripts, mathematical symbols, and other formatting.
Basic Concepts
Simple Names
Regular variable names display as-is:
velocity→ velocityforce→ forcetemperature→ temperature
Names ending with underscore use regular font with spaces:
total_cost_→ total costheat_flow_rate_→ heat flow ratemax_speed_→ max speedNote: The trailing underscore converts underscores to spaces
Special Separators
Single Underscore _ Rules
A single underscore has different meanings depending on what follows it:
For regular text - creates subscripts:
v_max→ vmaxF_applied→ Fappliedx_1→ x1
For Greek keywords - converts and subscripts:
alpha_1→ α1 (converts 'alpha' to α and subscripts '1')sigma_yield→ σyield(converts 'sigma' to σ and subscripts 'yield')
For special keywords - triggers special formatting:
x_prm→ x′ (prime right notation)prm_x→ ′x (prime left notation)ovr_x→ xˉ (overline for averages)
Combined with double underscore for superscripts:
x_1__2→ x12 (x subscript 1, squared)v_final__2→ vfinal2 (final velocity squared)
Formatting Syntax
Subscripts and Superscripts
Use underscores followed by special placeholders:
name_text
Subscript
v_max → vmax
name__text
Superscript
x__2 → x2
name_sub__sup
Both
x_i__2 → xi2
Complete Mathematical Symbol Reference
CalcTree automatically converts certain keywords to mathematical symbols when a variable is rendered on the page:
Lowercase Greek
alpha
α
alpha_1
α1
beta
β
beta_coefficient
βcoefficient
gamma
γ
gamma_ray
γray
delta
δ
delta_t
δt
epsilon
ε
epsilon_0
ϵ0
zeta
ζ
zeta_function
ζfunction
eta
η
eta_efficiency
ηefficiency
theta
θ
theta_angle
θangle
iota
ι
iota_value
ιvalue
kappa
κ
kappa_constant
κconstant
lambda
λ
lambda_wavelength
λwavelength
mu
μ
mu_friction
μfriction
nu
ν
nu_frequency
νfrequency
xi
ξ
xi_parameter
ξparameter
omicron
ο
omicron_value
οvalue
pi
π
pi_constant
πconstant
rho
ρ
rho_density
ρdensity
sigma
σ
sigma_stress
σstress
tau
τ
tau_torque
τtorque
upsilon
υ
upsilon_velocity
υvelocity
phi
φ
phi_angle
ϕangle
chi
χ
chi_squared
χsquared
psi
ψ
psi_wave
ψwave
omega
ω
omega_angular
ωangular
Uppercase Greek
Alpha
Α
Alpha_particle
Aparticle
Beta
Β
Beta_function
Bfunction
Gamma
Γ
Gamma_distribution
Γdistribution
Delta
Δ
Delta_H
ΔH
Epsilon
Ε
Epsilon_field
Efield
Zeta
Ζ
Zeta_potential
Zpotential
Eta
Η
Eta_meson
Hmeson
Theta
Θ
Theta_temperature
Θtemperature
Iota
Ι
Iota_index
Iindex
Kappa
Κ
Kappa_number
Knumber
Lambda
Λ
Lambda_baryon
Λbaryon
Mu
Μ
Mu_mass
Mmass
Nu
Ν
Nu_neutrino
Nneutrino
Xi
Ξ
Xi_cascade
Ξcascade
Omicron
Ο
Omicron_variant
Ovariant
Pi
Π
Pi_product
Πproduct
Rho
Ρ
Rho_meson
Pmeson
Sigma
Σ
Sigma_sum
Σsum
Tau
Τ
Tau_lepton
Tlepton
Upsilon
Υ
Upsilon_meson
Υmeson
Phi
Φ
Phi_flux
Φflux
Chi
Χ
Chi_distribution
Xdistribution
Psi
Ψ
Psi_function
Ψfunction
Omega
Ω
Omega_resistance
Ωresistance
Greek Variations
varepsilon
ε
Variant epsilon
varkappa
ϰ
Variant kappa
varphi
φ
Variant phi
varpi
ϖ
Variant pi
varrho
ϱ
Variant rho
varsigma
ς
Variant sigma
vartheta
ϑ
Variant theta
Special Mathematical Symbols
infty
∞
T_infty
T∞
diameter
⌀
d_diameter
d∅
circ
°
angle_circ
angle∘
mid
|
x_mid
x∣
degree
°
temp_degree
temp°
star
⋆
rating_star
rating⋆
Punctuation & Operators
These symbols are inserted in the baseline (not as subscripts) when preceded by a single underscore:
prm
'
x_prm
x′
dot
.
v_dot
v˙
cma
,
item_cma_1
item,1
div
/
m_div_s
m/s
spc
(space)
total_spc_cost
totalcost
num
#
item_num_5
item#5
pls
+
charge_pls
charge+
mns
-
ion_mns
ion−
Special Directives
These create formatting effects:
sqrt
Square root
value_sqrt
value
prn
Parentheses
sum_prn
(sum)
ovr
Overline
x_ovr
x
Advanced Formatting
Special placeholder keywords after underscores:
Examples
Engineering Variables
Stress components:
sigma_xx→ σxx (sigma with xx subscript)sigma_y__2→ σy2 (sigma with y subscript and squared)tau_xy→ τxy (shear stress)
Heat transfer:
q_dot_→ qdot (heat flux, regular font)T_infty→ T∞ (temperature at infinity)alpha_thermal→ αthermal (thermal diffusivity)
Electrical:
V_rms→ Vrms (RMS voltage)I_peak__2→ Ipeak2 (peak current squared)Omega_resistance→ Ωresistance (resistance in ohms)
Physics & Mathematics
Wave functions:
psi_n→ ψn (wave function n)Psi_total→ Ψtotal (total wave function)
Statistics:
mu_population→ μpopulation (population mean)sigma_x→ σx (standard deviation)chi__2→ χ2 (chi-squared)
Calculus:
Delta_x→ Δx (change in x)epsilon_0→ ϵ0 (permittivity of free space)
Reserved Keywords
These words cannot be used as variable names:
MathJS Reserved: mod, to, in, and, xor, or, not, end
Python Reserved (for compatibility): False, None, True, and, as, assert, async, await, break, class, continue, def, del, elif, else, except, finally, for, from, global, if, import, in, is, lambda, nonlocal, not, or, pass, raise, return, try, while, with, yield
Best Practices
Use meaningful base names:
sigma_yieldis better than justsigmaBe consistent: Use the same naming patterns throughout your project
Consider context:
Delta_Tfor temperature change,delta_smallfor small changesMix symbols wisely:
alpha_beta_ratio→ αbeta_ratio (only first part converts)
Quick Reference Card
Basic subscript:
variable_subscript→ variablesubscriptBasic superscript:
variable__superscript→ variablesuperscriptBoth:
variable_sub__sup→ variablesubsupGreek letter:
alpha_1→ α1Uppercase Greek:
Delta_x→ ΔxRegular font (spaces):
my_variable_→ myvariableOverline:
x_ovr→ xSquare root:
value_sqrt→ valueParentheses:
term_prn→ (term)Prime notation:
x_prm→ x′Infinity:
T_infty→ T∞Multi-part:
part1_bsl_part2→ part1/part2
Troubleshooting
Variable not displaying as expected?
Check if you're using the correct number of underscores
Verify the keyword is in the supported symbols list
Ensure no typos in placeholder keywords
Calculation errors?
Confirm the base name is a valid identifier
Check for reserved keywords conflict
Verify syntax without special formatting first
Last updated