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
→force
→temperature
→
Names ending with underscore use regular font with spaces:
total_cost_
→heat_flow_rate_
→max_speed_
→Note: 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
→F_applied
→x_1
→
For Greek keywords - converts and subscripts:
alpha_1
→ (converts 'alpha' to α and subscripts '1')sigma_yield
→ (converts 'sigma' to σ and subscripts 'yield')
For special keywords - triggers special formatting:
x_prm
→ (prime right notation)prm_x
→ (prime left notation)ovr_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
→
name__text
Superscript
x__2
→
name_sub__sup
Both
x_i__2
→
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
beta
β
beta_coefficient
gamma
γ
gamma_ray
delta
δ
delta_t
epsilon
ε
epsilon_0
zeta
ζ
zeta_function
eta
η
eta_efficiency
theta
θ
theta_angle
iota
ι
iota_value
kappa
κ
kappa_constant
lambda
λ
lambda_wavelength
mu
μ
mu_friction
nu
ν
nu_frequency
xi
ξ
xi_parameter
omicron
ο
omicron_value
pi
π
pi_constant
rho
ρ
rho_density
sigma
σ
sigma_stress
tau
τ
tau_torque
upsilon
υ
upsilon_velocity
phi
φ
phi_angle
chi
χ
chi_squared
psi
ψ
psi_wave
omega
ω
omega_angular
Uppercase Greek
Alpha
Α
Alpha_particle
Beta
Β
Beta_function
Gamma
Γ
Gamma_distribution
Delta
Δ
Delta_H
Epsilon
Ε
Epsilon_field
Zeta
Ζ
Zeta_potential
Eta
Η
Eta_meson
Theta
Θ
Theta_temperature
Iota
Ι
Iota_index
Kappa
Κ
Kappa_number
Lambda
Λ
Lambda_baryon
Mu
Μ
Mu_mass
Nu
Ν
Nu_neutrino
Xi
Ξ
Xi_cascade
Omicron
Ο
Omicron_variant
Pi
Π
Pi_product
Rho
Ρ
Rho_meson
Sigma
Σ
Sigma_sum
Tau
Τ
Tau_lepton
Upsilon
Υ
Upsilon_meson
Phi
Φ
Phi_flux
Chi
Χ
Chi_distribution
Psi
Ψ
Psi_function
Omega
Ω
Omega_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
diameter
⌀
d_diameter
circ
°
angle_circ
mid
|
x_mid
degree
°
temp_degree
star
⋆
rating_star
Punctuation & Operators
These symbols are inserted in the baseline (not as subscripts) when preceded by a single underscore:
prm
'
x_prm
dot
.
v_dot
cma
,
item_cma_1
div
/
m_div_s
spc
(space)
total_spc_cost
num
#
item_num_5
pls
+
charge_pls
mns
-
ion_mns
Special Directives
These create formatting effects:
sqrt
Square root
value_sqrt
prn
Parentheses
sum_prn
ovr
Overline
x_ovr
Advanced Formatting
Special placeholder keywords after underscores:
Examples
Engineering Variables
Stress components:
sigma_xx
→ (sigma with xx subscript)sigma_y__2
→ (sigma with y subscript and squared)tau_xy
→ (shear stress)
Heat transfer:
q_dot_
→ (heat flux, regular font)T_infty
→ (temperature at infinity)alpha_thermal
→ (thermal diffusivity)
Electrical:
V_rms
→ (RMS voltage)I_peak__2
→ (peak current squared)Omega_resistance
→ (resistance in ohms)
Physics & Mathematics
Wave functions:
psi_n
→ (wave function n)Psi_total
→ (total wave function)
Statistics:
mu_population
→ (population mean)sigma_x
→ (standard deviation)chi__2
→ (chi-squared)
Calculus:
Delta_x
→ (change in x)epsilon_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_yield
is better than justsigma
Be consistent: Use the same naming patterns throughout your project
Consider context:
Delta_T
for temperature change,delta_small
for small changesMix symbols wisely:
alpha_beta_ratio
→ (only first part converts)
Quick Reference Card
Basic subscript:
variable_subscript
→Basic superscript:
variable__superscript
→Both:
variable_sub__sup
→Greek letter:
alpha_1
→Uppercase Greek:
Delta_x
→Regular font (spaces):
my_variable_
→Overline:
x_ovr
→Square root:
value_sqrt
→Parentheses:
term_prn
→Prime notation:
x_prm
→Infinity:
T_infty
→Multi-part:
part1_bsl_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