diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,8 @@
+texmath (0.13.1.1)
+
+  * Typst writer: don't add extra spaces around `|` or escaped
+    symbols (#286).
+
 texmath (0.13.1)
 
   * MathML writer: Keep mathvariant attribute in addition to finding
diff --git a/src/Text/TeXMath/Writers/Typst.hs b/src/Text/TeXMath/Writers/Typst.hs
--- a/src/Text/TeXMath/Writers/Typst.hs
+++ b/src/Text/TeXMath/Writers/Typst.hs
@@ -43,7 +43,11 @@
 writeExps = go . map writeExp
  where
    go (a : b : es)
-    | T.take 1 b == "'" -- avoid space before a prime #239
+    | Just (bstart, _) <- T.uncons b
+    , Just (astart, _) <- T.uncons a
+    , Just (_, aend) <- T.unsnoc a
+    , bstart == '\'' -- avoid space before a prime #239
+      || bstart == '|' || aend == '|' || bstart == '\\' || astart == '\\' -- #286
      = a <> go (b:es)
    go (a : as)
      = a <> if null as
diff --git a/test/writer/typst/07.test b/test/writer/typst/07.test
--- a/test/writer/typst/07.test
+++ b/test/writer/typst/07.test
@@ -20,4 +20,4 @@
 , EIdentifier "a"
 ]
 >>> typst
-u'' + p (x) u' + q (x) u = f (x) \, quad x > a
+u'' + p (x) u' + q (x) u = f (x)\,quad x > a
diff --git a/test/writer/typst/08.test b/test/writer/typst/08.test
--- a/test/writer/typst/08.test
+++ b/test/writer/typst/08.test
@@ -30,4 +30,4 @@
 , EDelimited "(" ")" [ Right (EIdentifier "z") ]
 ]
 >>> typst
-lr(|macron(z)|) = lr(|z|) \, lr(|(macron(z))^n|) = lr(|z|)^n \, arg (z^n) = n arg (z)
+lr(|macron(z)|) = lr(|z|)\,lr(|(macron(z))^n|) = lr(|z|)^n\,arg (z^n) = n arg (z)
diff --git a/test/writer/typst/11.test b/test/writer/typst/11.test
--- a/test/writer/typst/11.test
+++ b/test/writer/typst/11.test
@@ -23,4 +23,4 @@
     NormalFrac (ENumber "1") (ESub (EIdentifier "l") (ENumber "0"))
 ]
 >>> typst
-phi.alt_n (kappa) = 0.033 C_n^2 kappa^(- 11 \/ 3) \, quad 1 / L_0 lt.double kappa lt.double 1 / l_0
+phi.alt_n (kappa) = 0.033 C_n^2 kappa^(- 11\/3)\,quad 1 / L_0 lt.double kappa lt.double 1 / l_0
diff --git a/test/writer/typst/complex1.test b/test/writer/typst/complex1.test
--- a/test/writer/typst/complex1.test
+++ b/test/writer/typst/complex1.test
@@ -601,12 +601,12 @@
     ]
 ]
 >>> typst
-upright("Bernoulli Trials") & P \( E \) = (n / k) p_()^k \( 1 - p \)_()^(n - k)\
+upright("Bernoulli Trials") & P\(E\) = (n / k) p_()^k\(1 - p\)_()^(n - k)\
 upright("Cauchy-Schwarz Inequality") & (sum_(k = 1)^n a_k^() b_k^())_()^2 lt.eq (sum_(k = 1)^n a_k^2) (sum_(k = 1)^n b_k^2)\
-upright("Cauchy Formula") & f \( z \) thin dot.c "Ind"_gamma^() \( z \) = frac(1, 2 pi i) integral.cont_gamma^() frac(f \( xi \), xi - z) thin d xi\
+upright("Cauchy Formula") & f\(z\)thin dot.c "Ind"_gamma^()\(z\)= frac(1, 2 pi i) integral.cont_gamma^() frac(f\(xi\), xi - z) thin d xi\
 upright("Cross Product") & V_1^() times V_2^() = mat(delim: "|", i, j, k; frac(partial X, partial u), frac(partial Y, partial u), 0; frac(partial X, partial v), frac(partial Y, partial v), 0)\
-upright("Vandermonde Determinant") & mat(delim: "|", 1, 1, dots.h.c, 1; v_1^(), v_2^(), dots.h.c, v_n^(); v_1^2, v_2^2, dots.h.c, v_n^2; dots.v, dots.v, dots.down, dots.v; v_1^(n - 1), v_2^(n - 1), dots.h.c, v_n^(n - 1)) = product_(1 lt.eq i < j lt.eq n)^() \( v_j^() - v_i^() \)\
-upright("Lorenz Equations") & accent(x, ˙)_() & = & sigma \( y - x \)\
+upright("Vandermonde Determinant") & mat(delim: "|", 1, 1, dots.h.c, 1; v_1^(), v_2^(), dots.h.c, v_n^(); v_1^2, v_2^2, dots.h.c, v_n^2; dots.v, dots.v, dots.down, dots.v; v_1^(n - 1), v_2^(n - 1), dots.h.c, v_n^(n - 1)) = product_(1 lt.eq i < j lt.eq n)^()\(v_j^() - v_i^()\)\
+upright("Lorenz Equations") & accent(x, ˙)_() & = & sigma\(y - x\)\
 accent(y, ˙)_() & = & rho x - y - x z\
 accent(z, ˙)_() & = & - beta z + x y\
 upright("Maxwell's Equations") & {nabla zws times accent(B, ↼)_() - thin 1 / c thin frac(partial zws accent(E, ↼)_(), partial zws t) & = & frac(4 pi, c) thin accent(j, ↼)_()\
@@ -614,9 +614,9 @@
 nabla zws times accent(E, ↼)_() thin + thin 1 / c thin frac(partial zws accent(B, ↼)_(), partial zws t) & = & accent(0, ↼)_()\
 nabla zws dot.c accent(B, ↼)_() & = & 0\
 upright("Einstein Field Equations") & R_(mu nu)^() - 1 / 2 thin g_(mu nu)^() thin R = frac(8 pi G, c_()^4) thin T_(mu nu)^()\
-upright("Ramanujan Identity") & frac(1, \( sqrt(phi sqrt(5)) - phi \) e_()^(25 / pi)) = 1 + frac(e_()^(- 2 pi), 1 + frac(e_()^(- 4 pi), 1 + frac(e_()^(- 6 pi), 1 + frac(e_()^(- 8 pi), 1 + dots.h))))\
+upright("Ramanujan Identity") & frac(1, \(sqrt(phi sqrt(5)) - phi\)e_()^(25 / pi)) = 1 + frac(e_()^(- 2 pi), 1 + frac(e_()^(- 4 pi), 1 + frac(e_()^(- 6 pi), 1 + frac(e_()^(- 8 pi), 1 + dots.h))))\
 upright("Another Ramanujan identity") & sum_(k = 1)^oo 1 / 2_()^(floor.l k dot.c zws phi floor.r) = frac(1, 2_()^0 + frac(1, 2_()^1 + dots.h.c))\
-upright("Rogers-Ramanujan Identity") & 1 + sum_(k = 1)^oo frac(q_()^(k_()^2 + k), \( 1 - q \) \( 1 - q_()^2 \) dots.h.c \( 1 - q_()^k \)) = product_(j = 0)^oo frac(1, \( 1 - q_()^(5 j + 2) \) \( 1 - q_()^(5 j + 3) \)) \, upright("  ") upright("  ") f o r med \| q \| < 1 .\
+upright("Rogers-Ramanujan Identity") & 1 + sum_(k = 1)^oo frac(q_()^(k_()^2 + k), \(1 - q\)\(1 - q_()^2\)dots.h.c\(1 - q_()^k\)) = product_(j = 0)^oo frac(1, \(1 - q_()^(5 j + 2)\)\(1 - q_()^(5 j + 3)\))\,upright("  ") upright("  ") f o r med\|q\|< 1 .\
 upright("Commutative Diagram") & H & arrow.l & K\
 arrow.b & zws & arrow.t\
 H & arrow.r & K
diff --git a/test/writer/typst/complex2.test b/test/writer/typst/complex2.test
--- a/test/writer/typst/complex2.test
+++ b/test/writer/typst/complex2.test
@@ -393,16 +393,16 @@
 >>> typst
 upright("Quadratic Equation") & x = frac(- b plus.minus sqrt(b_()^2 - 4 a c), 2 a)\
 upright("DisplayQuadratic Equation") & x = frac(- b plus.minus sqrt(b_()^2 - 4 a c), 2 a)\
-upright("Rational Function") & f \( x \) = frac(1 - x_()^2, 1 - x_()^3)\
-upright("Rational Function") & f \( x \) = frac(\( 1 - x_()^2 \) x_()^3, 1 - x_()^3)\
-upright("Rational Function") & f \( x \) = frac(\( 1 - x_()^2 \) \( x_()^3 - 5 x \), 1 - x_()^3)\
-upright("Parametrize Rational Function") & f \( x \) = frac(\( a_i^() - x_()^2 \)_()^5, 1 - x_()^3)\
-upright("Stacked exponents") & g \( z \) = e_()^(- x_()^2)\
-upright("Stacked exponents") & g \( z \) = e_()^(- \( z - a \)_()^2)\
-upright("Stacked exponents") & g \( z \) = e_()^(- sum_(i = 0)^oo z_i^2)\
-upright("Stacked exponents") & g \( y \) = e_()^(- sum_(i = 0)^oo y_i^2)\
-upright("Stacked exponents") & g \( z \) = e_()^(- sum_(i = 0)^oo z_()^(frac(2, a - i)))\
+upright("Rational Function") & f\(x\)= frac(1 - x_()^2, 1 - x_()^3)\
+upright("Rational Function") & f\(x\)= frac(\(1 - x_()^2\)x_()^3, 1 - x_()^3)\
+upright("Rational Function") & f\(x\)= frac(\(1 - x_()^2\)\(x_()^3 - 5 x\), 1 - x_()^3)\
+upright("Parametrize Rational Function") & f\(x\)= frac(\(a_i^() - x_()^2\)_()^5, 1 - x_()^3)\
+upright("Stacked exponents") & g\(z\)= e_()^(- x_()^2)\
+upright("Stacked exponents") & g\(z\)= e_()^(-\(z - a\)_()^2)\
+upright("Stacked exponents") & g\(z\)= e_()^(- sum_(i = 0)^oo z_i^2)\
+upright("Stacked exponents") & g\(y\)= e_()^(- sum_(i = 0)^oo y_i^2)\
+upright("Stacked exponents") & g\(z\)= e_()^(- sum_(i = 0)^oo z_()^(frac(2, a - i)))\
 upright("Cross Product") & frac(x_1^() - x_2^(), x_3^() - x_4^()) frac(x_1^() - x_4^(), x_2^() - x_3^())\
-upright("Cross Product") & \( frac(x_1^() - x_2^(), x_3^() - x_4^()) \) \( frac(x_1^() - x_4^(), x_2^() - x_3^()) \)\
+upright("Cross Product") & \(frac(x_1^() - x_2^(), x_3^() - x_4^())\)\(frac(x_1^() - x_4^(), x_2^() - x_3^())\)\
 upright("Cross Product") & (frac(x_1^() - x_2^(), x_3^() - x_4^())) (frac(x_1^() - x_4^(), x_2^() - x_3^()))\
-upright("Cross Product") & frac(\( x_1^() - x_2^() \) \( x_3^() - x_4^() \), \( x_1^() - x_4^() \) \( x_2^() - x_3^() \))
+upright("Cross Product") & frac(\(x_1^() - x_2^()\)\(x_3^() - x_4^()\), \(x_1^() - x_4^()\)\(x_2^() - x_3^()\))
diff --git a/test/writer/typst/differentiable_manifold.test b/test/writer/typst/differentiable_manifold.test
--- a/test/writer/typst/differentiable_manifold.test
+++ b/test/writer/typst/differentiable_manifold.test
@@ -59,5 +59,5 @@
     ]
 ]
 >>> typst
-gamma_1 equiv gamma_2 arrow.l.r.double {gamma_1 (0) = gamma_2 (0) = p \, upright(" and ")\
+gamma_1 equiv gamma_2 arrow.l.r.double {gamma_1 (0) = gamma_2 (0) = p\,upright(" and ")\
 frac(upright(d), upright(d) t) phi.alt compose gamma_1 (t)\|_(t = 0) = frac(upright(d), upright(d) t) phi.alt compose gamma_2 (t)\|_(t = 0)
diff --git a/test/writer/typst/sphere_volume.test b/test/writer/typst/sphere_volume.test
--- a/test/writer/typst/sphere_volume.test
+++ b/test/writer/typst/sphere_volume.test
@@ -126,7 +126,7 @@
     ]
 ]
 >>> typst
-S = { 0 lt.eq phi.alt lt.eq 2 pi \, med 0 lt.eq theta lt.eq pi \, med 0 lt.eq rho lt.eq R } upright(V o l u m e) & = integral.triple_S #h(-1em) rho^2 sin theta thin upright(d) rho thin upright(d) theta thin upright(d) phi.alt\
+S = { 0 lt.eq phi.alt lt.eq 2 pi\,med 0 lt.eq theta lt.eq pi\,med 0 lt.eq rho lt.eq R } upright(V o l u m e) & = integral.triple_S #h(-1em) rho^2 sin theta thin upright(d) rho thin upright(d) theta thin upright(d) phi.alt\
  & = integral_0^(2 pi) #h(-1em) upright(d) phi.alt thin integral_0^pi #h(-1em) sin theta thin upright(d) theta thin integral_0^R #h(-1em) rho^2 upright(d) rho\
  & = phi.alt #scale(x: 180%, y: 180%)[\|]_0^(2 pi) med (- cos theta) #scale(x: 180%, y: 180%)[\|]_0^pi med 1 / 3 rho^3 #scale(x: 180%, y: 180%)[\|]_0^R\
  & = 2 pi times 2 times 1 / 3 R^3\
diff --git a/texmath.cabal b/texmath.cabal
--- a/texmath.cabal
+++ b/texmath.cabal
@@ -1,5 +1,5 @@
 Name:                texmath
-Version:             0.13.1
+Version:             0.13.1.1
 Cabal-Version:       >= 1.10
 Build-type:          Simple
 Synopsis:            Conversion between math formats.
