Repository: yt-project/unyt
Pull request #120 (2020-01-16 10:11:54)

Ensured that solar units (e.g. M_odot) do not appear with italics
Solar system units currently appear with italics, e.g. M_\odot has the M italicised - this is incorrect behaviour.

This minor change fixes that.

I had a few test failures but they appear to be related to sympy deprecations and nothing to do with these changes, so I will see what Travis says with your config.


Patch:
diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py
index 229dbf4..6246ea9 100644
--- a/unyt/_unit_lookup_table.py
+++ b/unyt/_unit_lookup_table.py
@@ -191,15 +191,21 @@ default_unit_symbol_lut = OrderedDict(
         # Velocities
         ("c", (speed_of_light_m_per_s, dimensions.velocity, 0.0, r"\rm{c}", False)),
         # Solar units
-        ("Msun", (mass_sun_kg, dimensions.mass, 0.0, r"M_\odot", False)),
-        ("Rsun", (m_per_rsun, dimensions.length, 0.0, r"R_\odot", False)),
-        ("Lsun", (luminosity_sun_watts, dimensions.power, 0.0, r"L_\odot", False)),
-        ("Tsun", (temp_sun_kelvin, dimensions.temperature, 0.0, r"T_\odot", False)),
-        ("Zsun", (metallicity_sun, dimensions.dimensionless, 0.0, r"Z_\odot", False)),
-        ("Mjup", (mass_jupiter_kg, dimensions.mass, 0.0, r"M_{\rm{Jup}}", False)),
-        ("Mearth", (mass_earth_kg, dimensions.mass, 0.0, r"M_\oplus", False)),
-        ("Rjup", (m_per_rjup, dimensions.length, 0.0, r"R_\mathrm{Jup}", False)),
-        ("Rearth", (m_per_rearth, dimensions.length, 0.0, r"R_\oplus", False)),
+        ("Msun", (mass_sun_kg, dimensions.mass, 0.0, r"\rm{M}_\odot", False)),
+        ("Rsun", (m_per_rsun, dimensions.length, 0.0, r"\rm{R}_\odot", False)),
+        ("Lsun", (luminosity_sun_watts, dimensions.power, 0.0, r"\rm{L}_\odot", False)),
+        (
+            "Tsun",
+            (temp_sun_kelvin, dimensions.temperature, 0.0, r"\rm{T}_\odot", False),
+        ),
+        (
+            "Zsun",
+            (metallicity_sun, dimensions.dimensionless, 0.0, r"\rm{Z}_\odot", False),
+        ),
+        ("Mjup", (mass_jupiter_kg, dimensions.mass, 0.0, r"\rm{M}_{\rm{Jup}}", False)),
+        ("Mearth", (mass_earth_kg, dimensions.mass, 0.0, r"\rm{M}_\oplus", False)),
+        ("Rjup", (m_per_rjup, dimensions.length, 0.0, r"\rm{R}_\mathrm{Jup}", False)),
+        ("Rearth", (m_per_rearth, dimensions.length, 0.0, r"\rm{R}_\oplus", False)),
         # astro distances
         ("AU", (m_per_au, dimensions.length, 0.0, r"\rm{AU}", False)),
         ("ly", (m_per_ly, dimensions.length, 0.0, r"\rm{ly}", False)),
@@ -240,14 +246,14 @@ default_unit_symbol_lut = OrderedDict(
         ("q_pl", (planck_charge_C, dimensions.charge_mks, 0.0, r"q_{\rm{P}}", False)),
         ("E_pl", (planck_energy_J, dimensions.energy, 0.0, r"E_{\rm{P}}", False)),
         # Geometrized units
-        ("m_geom", (mass_sun_kg, dimensions.mass, 0.0, r"M_\odot", False)),
+        ("m_geom", (mass_sun_kg, dimensions.mass, 0.0, r"\rm{M}_\odot", False)),
         (
             "l_geom",
             (
                 newton_mks * mass_sun_kg / speed_of_light_m_per_s ** 2,
                 dimensions.length,
                 0.0,
-                r"M_\odot",
+                r"\rm{M}_\odot",
                 False,
             ),
         ),
@@ -257,7 +263,7 @@ default_unit_symbol_lut = OrderedDict(
                 newton_mks * mass_sun_kg / speed_of_light_m_per_s ** 3,
                 dimensions.time,
                 0.0,
-                r"M_\odot",
+                r"\rm{M}_\odot",
                 False,
             ),
         ),


Test patch:
diff --git a/unyt/tests/old_json_registry.txt b/unyt/tests/old_json_registry.txt
index ba797e6..7c8fc30 100644
--- a/unyt/tests/old_json_registry.txt
+++ b/unyt/tests/old_json_registry.txt
@@ -1,1 +1,1 @@
-{"g": [1.0, "Symbol('(mass)', positive=True)", 0.0, "\\rm{g}"], "s": [1.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{s}"], "K": [1.0, "Symbol('(temperature)', positive=True)", 0.0, "\\rm{K}"], "radian": [1.0, "Symbol('(angle)', positive=True)", 0.0, "\\rm{radian}"], "dyne": [1.0, "Mul(Symbol('(length)', positive=True), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{dyn}"], "erg": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{erg}"], "esu": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(3, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{esu}"], "gauss": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(-1, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{G}"], "degC": [1.0, "Symbol('(temperature)', positive=True)", -273.15, "^\\circ\\rm{C}"], "statA": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(3, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{statA}"], "statV": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(1, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{statV}"], "statohm": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(-1)), Symbol('(time)', positive=True))", 0.0, "\\rm{statohm}"], "m": [100.0, "Symbol('(length)', positive=True)", 0.0, "\\rm{m}"], "J": [10000000.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{J}"], "W": [10000000.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "\\rm{W}"], "Hz": [1.0, "Pow(Symbol('(time)', positive=True), Integer(-1))", 0.0, "\\rm{Hz}"], "N": [100000.0, "Mul(Symbol('(length)', positive=True), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{N}"], "C": [1.0, "Mul(Symbol('(current_mks)', positive=True), Symbol('(time)', positive=True))", 0.0, "\\rm{C}"], "A": [1.0, "Symbol('(current_mks)', positive=True)", 0.0, "\\rm{A}"], "T": [1000.0, "Mul(Pow(Symbol('(current_mks)', positive=True), Integer(-1)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{T}"], "Pa": [10.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(-1)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{Pa}"], "V": [10000000.0, "Mul(Pow(Symbol('(current_mks)', positive=True), Integer(-1)), Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "\\rm{V}"], "ohm": [10000000.0, "Mul(Pow(Symbol('(current_mks)', positive=True), Integer(-2)), Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "\\Omega"], "ft": [30.48, "Symbol('(length)', positive=True)", 0.0, "\\rm{ft}"], "mile": [160934.4, "Symbol('(length)', positive=True)", 0.0, "\\rm{mile}"], "degF": [0.5555555555555556, "Symbol('(temperature)', positive=True)", -459.67, "^\\circ\\rm{F}"], "R": [0.5555555555555556, "Symbol('(temperature)', positive=True)", 0.0, "^\\circ\\rm{R}"], "lbf": [444822.16152605, "Mul(Symbol('(length)', positive=True), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{lbf}"], "lbm": [453.59237, "Symbol('(mass)', positive=True)", 0.0, "\\rm{lbm}"], "atm": [1013250.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(-1)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{atm}"], "h": [0.702, "Integer(1)", 0.0, "h"], "dimensionless": [1.0, "Integer(1)", 0.0, ""], "min": [60.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{min}"], "hr": [3600.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{hr}"], "day": [86400.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{d}"], "d": [86400.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{d}"], "yr": [31557600.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{yr}"], "c": [29979245800.0, "Mul(Symbol('(length)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{c}"], "Msun": [1.98841586e+33, "Symbol('(mass)', positive=True)", 0.0, "M_\\odot"], "msun": [1.98841586e+33, "Symbol('(mass)', positive=True)", 0.0, "M_\\odot"], "Rsun": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "R_\\odot"], "rsun": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "R_\\odot"], "R_sun": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "R_\\odot"], "r_sun": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "R_\\odot"], "Lsun": [3.827e+33, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "L_\\odot"], "Tsun": [5870.0, "Symbol('(temperature)', positive=True)", 0.0, "T_\\odot"], "Zsun": [0.01295, "Integer(1)", 0.0, "Z_\\odot"], "Mjup": [1.8985234333630655e+30, "Symbol('(mass)', positive=True)", 0.0, "M_{\\rm{Jup}}"], "Mearth": [6.045644495102106e+27, "Symbol('(mass)', positive=True)", 0.0, "M_\\oplus"], "AU": [14959787075076.674, "Symbol('(length)', positive=True)", 0.0, "\\rm{AU}"], "au": [14959787075076.674, "Symbol('(length)', positive=True)", 0.0, "\\rm{AU}"], "ly": [9.460528409678268e+17, "Symbol('(length)', positive=True)", 0.0, "\\rm{ly}"], "pc": [3.0856775809623245e+18, "Symbol('(length)', positive=True)", 0.0, "\\rm{pc}"], "degree": [0.017453292519943295, "Symbol('(angle)', positive=True)", 0.0, "^\\circ"], "arcmin": [0.0002908882086657216, "Symbol('(angle)', positive=True)", 0.0, "\\rm{arcmin}"], "arcsec": [4.84813681109536e-06, "Symbol('(angle)', positive=True)", 0.0, "\\rm{arcsec}"], "mas": [4.8481368110953594e-09, "Symbol('(angle)', positive=True)", 0.0, "\\rm{mas}"], "hourangle": [0.2617993877991494, "Symbol('(angle)', positive=True)", 0.0, "\\rm{HA}"], "steradian": [1.0, "Pow(Symbol('(angle)', positive=True), Integer(2))", 0.0, "\\rm{sr}"], "lat": [-0.017453292519943295, "Symbol('(angle)', positive=True)", 90.0, "\\rm{Latitude}"], "lon": [0.017453292519943295, "Symbol('(angle)', positive=True)", -180.0, "\\rm{Longitude}"], "eV": [1.602176562e-12, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{eV}"], "amu": [1.660538921e-24, "Symbol('(mass)', positive=True)", 0.0, "\\rm{amu}"], "angstrom": [1e-08, "Symbol('(length)', positive=True)", 0.0, "\\AA"], "Jy": [1e-23, "Mul(Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{Jy}"], "counts": [1.0, "Integer(1)", 0.0, "\\rm{counts}"], "photons": [1.0, "Integer(1)", 0.0, "\\rm{photons}"], "me": [9.10938291e-28, "Symbol('(mass)', positive=True)", 0.0, "m_e"], "mp": [1.6737352238051868e-24, "Symbol('(mass)', positive=True)", 0.0, "m_p"], "mol": [6.02214129011674e+23, "Integer(1)", 0.0, "\\rm{mol}"], "Sv": [10000.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{Sv}"], "rayleigh": [79577.47154594767, "Mul(Pow(Symbol('(angle)', positive=True), Integer(-2)), Pow(Symbol('(length)', positive=True), Integer(-2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{R}"], "solMass": [1.98841586e+33, "Symbol('(mass)', positive=True)", 0.0, "M_\\odot"], "solRad": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "R_\\odot"], "solLum": [3.827e+33, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "L_\\odot"], "dyn": [1.0, "Mul(Symbol('(length)', positive=True), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{dyn}"], "sr": [1.0, "Pow(Symbol('(angle)', positive=True), Integer(2))", 0.0, "\\rm{sr}"], "rad": [1.0, "Symbol('(angle)', positive=True)", 0.0, "\\rm{rad}"], "deg": [0.017453292519943295, "Symbol('(angle)', positive=True)", 0.0, "^\\circ"], "Fr": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(3, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{Fr}"], "G": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(-1, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{G}"], "Angstrom": [1e-08, "Symbol('(length)', positive=True)", 0.0, "\\AA"], "statC": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(3, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{statC}"], "m_pl": [2.1764701184435688e-05, "Symbol('(mass)', positive=True)", 0.0, "m_{\\rm{P}}"], "l_pl": [1.6162283157597786e-33, "Symbol('(length)', positive=True)", 0.0, "\\ell_\\rm{P}"], "t_pl": [5.391157357800438e-44, "Symbol('(time)', positive=True)", 0.0, "t_{\\rm{P}}"], "T_pl": [1.4168076561665009e+32, "Symbol('(temperature)', positive=True)", 0.0, "T_{\\rm{P}}"], "q_pl": [1.8755459562040954e-18, "Mul(Symbol('(current_mks)', positive=True), Symbol('(time)', positive=True))", 0.0, "q_{\\rm{P}}"], "E_pl": [1.9561137903170922e+16, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "E_{\\rm{P}}"], "m_geom": [1.98841586e+33, "Symbol('(mass)', positive=True)", 0.0, "M_\\odot"], "l_geom": [147658.08127593446, "Symbol('(length)', positive=True)", 0.0, "M_\\odot"], "t_geom": [4.925343427950227e-06, "Symbol('(time)', positive=True)", 0.0, "M_\\odot"], "R_earth": [637100801.9550942, "Symbol('(length)', positive=True)", 0.0, "R_\\oplus"], "r_earth": [637100801.9550942, "Symbol('(length)', positive=True)", 0.0, "R_\\oplus"], "R_jup": [6991100000.006706, "Symbol('(length)', positive=True)", 0.0, "R_\\mathrm{Jup}"], "r_jup": [6991100000.006706, "Symbol('(length)', positive=True)", 0.0, "R_\\mathrm{Jup}"], "code_length": [1.4065766789943524e+26, "Symbol('(length)', positive=True)", 0.0, "\\rm{code\\ length}"], "code_mass": [7.032854288130045e+48, "Symbol('(mass)', positive=True)", 0.0, "\\rm{code\\ mass}"], "code_density": [2.527210293640965e-30, "Mul(Pow(Symbol('(length)', positive=True), Integer(-3)), Symbol('(mass)', positive=True))", 0.0, "\\rm{code\\ density}"], "code_specific_energy": [2.1385728000000008e+18, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{code\\ specific\\ energy}"], "code_time": [1885954521538155.5, "Symbol('(time)', positive=True)", 0.0, "\\rm{code\\ time}"], "code_magnetic": [8.24114664867782e-06, "Mul(Pow(Symbol('(length)', positive=True), Rational(-1, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{code\\ magnetic}"], "code_temperature": [1.0, "Symbol('(temperature)', positive=True)", 0.0, "\\rm{code\\ temperature}"], "code_pressure": [1.4057425005421192e-08, "Mul(Pow(Symbol('(length)', positive=True), Integer(-1)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{code\\ pressure}"], "code_velocity": [1462385995.556577, "Mul(Symbol('(length)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{code\\ velocity}"], "code_metallicity": [1.0, "Integer(1)", 0.0, "\\rm{code\\ metallicity}"], "a": [1.0000000027810865, "Integer(1)", 0.0, "\\rm{a}"], "mcm": [100.00000027810864, "Symbol('(length)', positive=True)", 0.0, "\\rm{m}/(1+z)"], "pccm": [3.08567758954386e+18, "Symbol('(length)', positive=True)", 0.0, "\\rm{pc}/(1+z)"], "AUcm": [14959787116681.133, "Symbol('(length)', positive=True)", 0.0, "\\rm{AU}/(1+z)"], "aucm": [14959787116681.133, "Symbol('(length)', positive=True)", 0.0, "\\rm{au}/(1+z)"], "Mpccm": [3.08567758954386e+24, "Symbol('(length)', positive=True)", 0.0, "\\rm{Mpc}/(1+z)"], "cm": [1.0, "Symbol('(length)', positive=True)", 0.0, "\\rm{cm}"], "unitary": [1.4065766789943524e+26, "Symbol('(length)', positive=True)", 0.0, "\\rm{unitary}"], "keV": [1.602176562e-09, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{keV}"]}
\ No newline at end of file
+{"g": [1.0, "Symbol('(mass)', positive=True)", 0.0, "\\rm{g}"], "s": [1.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{s}"], "K": [1.0, "Symbol('(temperature)', positive=True)", 0.0, "\\rm{K}"], "radian": [1.0, "Symbol('(angle)', positive=True)", 0.0, "\\rm{radian}"], "dyne": [1.0, "Mul(Symbol('(length)', positive=True), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{dyn}"], "erg": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{erg}"], "esu": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(3, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{esu}"], "gauss": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(-1, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{G}"], "degC": [1.0, "Symbol('(temperature)', positive=True)", -273.15, "^\\circ\\rm{C}"], "statA": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(3, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{statA}"], "statV": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(1, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{statV}"], "statohm": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(-1)), Symbol('(time)', positive=True))", 0.0, "\\rm{statohm}"], "m": [100.0, "Symbol('(length)', positive=True)", 0.0, "\\rm{m}"], "J": [10000000.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{J}"], "W": [10000000.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "\\rm{W}"], "Hz": [1.0, "Pow(Symbol('(time)', positive=True), Integer(-1))", 0.0, "\\rm{Hz}"], "N": [100000.0, "Mul(Symbol('(length)', positive=True), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{N}"], "C": [1.0, "Mul(Symbol('(current_mks)', positive=True), Symbol('(time)', positive=True))", 0.0, "\\rm{C}"], "A": [1.0, "Symbol('(current_mks)', positive=True)", 0.0, "\\rm{A}"], "T": [1000.0, "Mul(Pow(Symbol('(current_mks)', positive=True), Integer(-1)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{T}"], "Pa": [10.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(-1)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{Pa}"], "V": [10000000.0, "Mul(Pow(Symbol('(current_mks)', positive=True), Integer(-1)), Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "\\rm{V}"], "ohm": [10000000.0, "Mul(Pow(Symbol('(current_mks)', positive=True), Integer(-2)), Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "\\Omega"], "ft": [30.48, "Symbol('(length)', positive=True)", 0.0, "\\rm{ft}"], "mile": [160934.4, "Symbol('(length)', positive=True)", 0.0, "\\rm{mile}"], "degF": [0.5555555555555556, "Symbol('(temperature)', positive=True)", -459.67, "^\\circ\\rm{F}"], "R": [0.5555555555555556, "Symbol('(temperature)', positive=True)", 0.0, "^\\circ\\rm{R}"], "lbf": [444822.16152605, "Mul(Symbol('(length)', positive=True), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{lbf}"], "lbm": [453.59237, "Symbol('(mass)', positive=True)", 0.0, "\\rm{lbm}"], "atm": [1013250.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(-1)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{atm}"], "h": [0.702, "Integer(1)", 0.0, "h"], "dimensionless": [1.0, "Integer(1)", 0.0, ""], "min": [60.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{min}"], "hr": [3600.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{hr}"], "day": [86400.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{d}"], "d": [86400.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{d}"], "yr": [31557600.0, "Symbol('(time)', positive=True)", 0.0, "\\rm{yr}"], "c": [29979245800.0, "Mul(Symbol('(length)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{c}"], "Msun": [1.98841586e+33, "Symbol('(mass)', positive=True)", 0.0, "\\rm{M}_\\odot"], "msun": [1.98841586e+33, "Symbol('(mass)', positive=True)", 0.0, "\\rm{M}_\\odot"], "Rsun": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\odot"], "rsun": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\odot"], "R_sun": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\odot"], "r_sun": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\odot"], "Lsun": [3.827e+33, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "\\rm{L}_\\odot"], "Tsun": [5870.0, "Symbol('(temperature)', positive=True)", 0.0, "\\rm{T}_\\odot"], "Zsun": [0.01295, "Integer(1)", 0.0, "\\rm{Z}_\\odot"], "Mjup": [1.8985234333630655e+30, "Symbol('(mass)', positive=True)", 0.0, "\\rm{M}_{\\rm{Jup}}"], "Mearth": [6.045644495102106e+27, "Symbol('(mass)', positive=True)", 0.0, "\\rm{M}_\\oplus"], "AU": [14959787075076.674, "Symbol('(length)', positive=True)", 0.0, "\\rm{AU}"], "au": [14959787075076.674, "Symbol('(length)', positive=True)", 0.0, "\\rm{AU}"], "ly": [9.460528409678268e+17, "Symbol('(length)', positive=True)", 0.0, "\\rm{ly}"], "pc": [3.0856775809623245e+18, "Symbol('(length)', positive=True)", 0.0, "\\rm{pc}"], "degree": [0.017453292519943295, "Symbol('(angle)', positive=True)", 0.0, "^\\circ"], "arcmin": [0.0002908882086657216, "Symbol('(angle)', positive=True)", 0.0, "\\rm{arcmin}"], "arcsec": [4.84813681109536e-06, "Symbol('(angle)', positive=True)", 0.0, "\\rm{arcsec}"], "mas": [4.8481368110953594e-09, "Symbol('(angle)', positive=True)", 0.0, "\\rm{mas}"], "hourangle": [0.2617993877991494, "Symbol('(angle)', positive=True)", 0.0, "\\rm{HA}"], "steradian": [1.0, "Pow(Symbol('(angle)', positive=True), Integer(2))", 0.0, "\\rm{sr}"], "lat": [-0.017453292519943295, "Symbol('(angle)', positive=True)", 90.0, "\\rm{Latitude}"], "lon": [0.017453292519943295, "Symbol('(angle)', positive=True)", -180.0, "\\rm{Longitude}"], "eV": [1.602176562e-12, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{eV}"], "amu": [1.660538921e-24, "Symbol('(mass)', positive=True)", 0.0, "\\rm{amu}"], "angstrom": [1e-08, "Symbol('(length)', positive=True)", 0.0, "\\AA"], "Jy": [1e-23, "Mul(Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{Jy}"], "counts": [1.0, "Integer(1)", 0.0, "\\rm{counts}"], "photons": [1.0, "Integer(1)", 0.0, "\\rm{photons}"], "me": [9.10938291e-28, "Symbol('(mass)', positive=True)", 0.0, "m_e"], "mp": [1.6737352238051868e-24, "Symbol('(mass)', positive=True)", 0.0, "m_p"], "mol": [6.02214129011674e+23, "Integer(1)", 0.0, "\\rm{mol}"], "Sv": [10000.0, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{Sv}"], "rayleigh": [79577.47154594767, "Mul(Pow(Symbol('(angle)', positive=True), Integer(-2)), Pow(Symbol('(length)', positive=True), Integer(-2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{R}"], "solMass": [1.98841586e+33, "Symbol('(mass)', positive=True)", 0.0, "\\rm{M}_\\odot"], "solRad": [69550001060.63751, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\odot"], "solLum": [3.827e+33, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-3)))", 0.0, "\\rm{L}_\\odot"], "dyn": [1.0, "Mul(Symbol('(length)', positive=True), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{dyn}"], "sr": [1.0, "Pow(Symbol('(angle)', positive=True), Integer(2))", 0.0, "\\rm{sr}"], "rad": [1.0, "Symbol('(angle)', positive=True)", 0.0, "\\rm{rad}"], "deg": [0.017453292519943295, "Symbol('(angle)', positive=True)", 0.0, "^\\circ"], "Fr": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(3, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{Fr}"], "G": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(-1, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{G}"], "Angstrom": [1e-08, "Symbol('(length)', positive=True)", 0.0, "\\AA"], "statC": [1.0, "Mul(Pow(Symbol('(length)', positive=True), Rational(3, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{statC}"], "m_pl": [2.1764701184435688e-05, "Symbol('(mass)', positive=True)", 0.0, "m_{\\rm{P}}"], "l_pl": [1.6162283157597786e-33, "Symbol('(length)', positive=True)", 0.0, "\\ell_\\rm{P}"], "t_pl": [5.391157357800438e-44, "Symbol('(time)', positive=True)", 0.0, "t_{\\rm{P}}"], "T_pl": [1.4168076561665009e+32, "Symbol('(temperature)', positive=True)", 0.0, "T_{\\rm{P}}"], "q_pl": [1.8755459562040954e-18, "Mul(Symbol('(current_mks)', positive=True), Symbol('(time)', positive=True))", 0.0, "q_{\\rm{P}}"], "E_pl": [1.9561137903170922e+16, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "E_{\\rm{P}}"], "m_geom": [1.98841586e+33, "Symbol('(mass)', positive=True)", 0.0, "\\rm{M}_\\odot"], "l_geom": [147658.08127593446, "Symbol('(length)', positive=True)", 0.0, "\\rm{M}_\\odot"], "t_geom": [4.925343427950227e-06, "Symbol('(time)', positive=True)", 0.0, "\\rm{M}_\\odot"], "R_earth": [637100801.9550942, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\oplus"], "r_earth": [637100801.9550942, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\oplus"], "R_jup": [6991100000.006706, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\mathrm{Jup}"], "r_jup": [6991100000.006706, "Symbol('(length)', positive=True)", 0.0, "\\rm{R}_\\mathrm{Jup}"], "code_length": [1.4065766789943524e+26, "Symbol('(length)', positive=True)", 0.0, "\\rm{code\\ length}"], "code_mass": [7.032854288130045e+48, "Symbol('(mass)', positive=True)", 0.0, "\\rm{code\\ mass}"], "code_density": [2.527210293640965e-30, "Mul(Pow(Symbol('(length)', positive=True), Integer(-3)), Symbol('(mass)', positive=True))", 0.0, "\\rm{code\\ density}"], "code_specific_energy": [2.1385728000000008e+18, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{code\\ specific\\ energy}"], "code_time": [1885954521538155.5, "Symbol('(time)', positive=True)", 0.0, "\\rm{code\\ time}"], "code_magnetic": [8.24114664867782e-06, "Mul(Pow(Symbol('(length)', positive=True), Rational(-1, 2)), Pow(Symbol('(mass)', positive=True), Rational(1, 2)), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{code\\ magnetic}"], "code_temperature": [1.0, "Symbol('(temperature)', positive=True)", 0.0, "\\rm{code\\ temperature}"], "code_pressure": [1.4057425005421192e-08, "Mul(Pow(Symbol('(length)', positive=True), Integer(-1)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{code\\ pressure}"], "code_velocity": [1462385995.556577, "Mul(Symbol('(length)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-1)))", 0.0, "\\rm{code\\ velocity}"], "code_metallicity": [1.0, "Integer(1)", 0.0, "\\rm{code\\ metallicity}"], "a": [1.0000000027810865, "Integer(1)", 0.0, "\\rm{a}"], "mcm": [100.00000027810864, "Symbol('(length)', positive=True)", 0.0, "\\rm{m}/(1+z)"], "pccm": [3.08567758954386e+18, "Symbol('(length)', positive=True)", 0.0, "\\rm{pc}/(1+z)"], "AUcm": [14959787116681.133, "Symbol('(length)', positive=True)", 0.0, "\\rm{AU}/(1+z)"], "aucm": [14959787116681.133, "Symbol('(length)', positive=True)", 0.0, "\\rm{au}/(1+z)"], "Mpccm": [3.08567758954386e+24, "Symbol('(length)', positive=True)", 0.0, "\\rm{Mpc}/(1+z)"], "cm": [1.0, "Symbol('(length)', positive=True)", 0.0, "\\rm{cm}"], "unitary": [1.4065766789943524e+26, "Symbol('(length)', positive=True)", 0.0, "\\rm{unitary}"], "keV": [1.602176562e-09, "Mul(Pow(Symbol('(length)', positive=True), Integer(2)), Symbol('(mass)', positive=True), Pow(Symbol('(time)', positive=True), Integer(-2)))", 0.0, "\\rm{keV}"]}
diff --git a/unyt/tests/test_units.py b/unyt/tests/test_units.py
index 35661e7..748e390 100644
--- a/unyt/tests/test_units.py
+++ b/unyt/tests/test_units.py
@@ -527,7 +527,7 @@ def test_latex_repr():
     assert_equal(test_unit.latex_repr, "\\frac{1}{\\rm{cm}^{3}}")
 
     test_unit = Unit("m_geom/l_geom**3")
-    assert_equal(test_unit.latex_repr, "\\frac{1}{M_\\odot^{2}}")
+    assert_equal(test_unit.latex_repr, "\\frac{1}{\\rm{M}_\\odot^{2}}")
 
     test_unit = Unit("1e9*cm")
     assert_equal(test_unit.latex_repr, "1.0 \\times 10^{9}\\ \\rm{cm}")