diff --git a/MANUAL.txt b/MANUAL.txt
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -1,7 +1,7 @@
 ---
 title: Pandoc User's Guide
 author: John MacFarlane
-date: February 14, 2024
+date: February 17, 2024
 ---
 
 # Synopsis
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,21 @@
 # Revision history for pandoc
 
+## pandoc 3.1.12.1 (2024-02-17)
+
+  * EPUB writer: omit EPUBv3-specific accessibility features on epub2
+    (#9469). Fixes a regression in 3.1.12.
+
+  * More fixes for SVG ids with `--self-contained` (#9467).
+    This generalizes the fix to #9420 so it applies to things like
+    `style="fill(url(#..."` and should fix problems with SVGs including
+    gradients.
+
+  * Powerpoint writer: properly handle math in headings and tables (#9465).
+    This ensures that paragraphs containing math are wrapped in
+    a `mc:AlternateContent` node as required.
+
+  * Makefile: make validate-epub check v2 output too.
+
 ## pandoc 3.1.12 (2024-02-14)
 
   * Add `djot` as input and output format. Djot is a light markup syntax
diff --git a/pandoc.cabal b/pandoc.cabal
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,6 +1,6 @@
 cabal-version:   2.4
 name:            pandoc
-version:         3.1.12
+version:         3.1.12.1
 build-type:      Simple
 license:         GPL-2.0-or-later
 license-file:    COPYING.md
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -179,17 +179,21 @@
                                     [(k,v) | (k,v) <- attrs', k /= "id"]
                       modify $ \st ->
                         st{ svgMap = M.insert hash (svgid, attrs'') (svgMap st) }
+                      let fixUrl x =
+                            case T.breakOn "url(#" x of
+                              (_,"") -> x
+                              (before, after) -> before <>
+                                  "url(#" <> svgid <> "_" <> T.drop 5 after
                       let addIdPrefix ("id", x) = ("id", svgid <> "_" <> x)
                           addIdPrefix (k, x)
                            | k == "xlink:href" || k == "href" =
                             case T.uncons x of
                               Just ('#', x') -> (k, "#" <> svgid <> "_" <> x')
                               _ -> (k, x)
-                          addIdPrefix ("clip-path", x) = ("clip-path",
-                            case T.stripPrefix "url(#" x of
-                              Just x' -> "url(#" <> svgid <> "_" <> x'
-                              Nothing -> x)
-                          addIdPrefix kv = kv
+                          -- this clause handles things like
+                          -- style="fill:url(#radialGradient46);stroke:none",
+                          -- adding the svg id prefix to the anchor:
+                          addIdPrefix (k, x) = (k, fixUrl x)
                       let ensureUniqueId (TagOpen tname ats) =
                             TagOpen tname (map addIdPrefix ats)
                           ensureUniqueId x = x
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -638,10 +638,9 @@
           ([("version", case version of
                              EPUB2 -> "2.0"
                              EPUB3 -> "3.0")
-           ,("xmlns","http://www.idpf.org/2007/opf")
-           ,("xml:lang", epubLanguage metadata)
-           ,("unique-identifier","epub-id-1")
-           ] ++
+           ,("xmlns","http://www.idpf.org/2007/opf")] ++
+           [("xml:lang", epubLanguage metadata) | version == EPUB3] ++
+           [("unique-identifier","epub-id-1")] ++
            [("prefix","ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/") | version == EPUB3]) $
           [ metadataElement version metadata currentTime
           , unode "manifest" $
@@ -1008,8 +1007,13 @@
                   ++ publisherNodes ++ sourceNodes ++ relationNodes
                   ++ coverageNodes ++ rightsNodes ++ coverImageNodes
                   ++ modifiedNodes ++ belongsToCollectionNodes
-                  ++ accessModeNodes ++ accessModeSufficientNodes ++ accessibilityFeatureNodes
-                  ++ accessibilityHazardNodes ++ accessibilitySummaryNodes
+                  ++ case version of
+                       EPUB2 -> []
+                       EPUB3 -> accessModeNodes ++
+                                accessModeSufficientNodes ++
+                                accessibilityFeatureNodes ++
+                                accessibilityHazardNodes ++
+                                accessibilitySummaryNodes
         metaprop = if version == EPUB2 then "name" else "property"
         withIds base f = concat . zipWith f (map (\x -> base <>
                                                         T.cons '-' (tshow x))
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Output.hs b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
--- a/src/Text/Pandoc/Writers/Powerpoint/Output.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
@@ -1054,7 +1054,8 @@
                [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
   return
     ( 1
-    ,  mknode "p:sp" [] [ mknode "p:nvSpPr" []
+    ,  surroundWithMathAlternate $
+       mknode "p:sp" [] [ mknode "p:nvSpPr" []
                           [ mknode "p:cNvPr" [("id","1"), ("name","TextBox 3")] ()
                           , mknode "p:cNvSpPr" [("txBox", "1")] ()
                           , mknode "p:nvPr" [] ()
@@ -1353,7 +1354,7 @@
   graphicFrameToElements layout tbls cptn
 shapeToElements _ (RawOOXMLShape str) = return
   [(Nothing, Text (CData CDataRaw str Nothing))]
-shapeToElements layout shp = do
+shapeToElements layout shp@(TextBox _) = do
   (shapeId, element) <- shapeToElement layout shp
   return [(shapeId, Elem element)]
 
@@ -1538,7 +1539,9 @@
       let txBody = mknode "p:txBody" [] $
                    [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <>
                    [element]
-      return (Just shapeIdNum, replaceNamedChildren ns "p" "txBody" [txBody] sp)
+      return (Just shapeIdNum,
+              surroundWithMathAlternate $
+                replaceNamedChildren ns "p" "txBody" [txBody] sp)
   -- XXX: TODO
   | otherwise = return (Nothing, mknode "p:sp" [] ())
 
@@ -2008,6 +2011,7 @@
   let txBody = mknode "p:txBody" [] $
                [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
   return $
+    surroundWithMathAlternate $
     mknode "p:sp" []
     [ mknode "p:nvSpPr" []
       [ mknode "p:cNvPr" [ ("id", "3")
diff --git a/test/command/9467.md b/test/command/9467.md
new file mode 100644
--- /dev/null
+++ b/test/command/9467.md
@@ -0,0 +1,58 @@
+```
+% pandoc --embed-resources
+![](command/9467.svg)
+^D
+<p><svg id="svg2" width="191.56267" height="151.71201" viewBox="0 0 191.56267 151.71201" xmlns:svg="http://www.w3.org/2000/svg">
+  <defs id="svg2_defs6">
+    <clipPath clipPathUnits="userSpaceOnUse" id="svg2_clipPath24">
+      <path d="M 56.69362,0 113.38724,113.38724 170.08086,0 Z" id="svg2_path22" />
+    </clipPath>
+    <clipPath clipPathUnits="userSpaceOnUse" id="svg2_clipPath38">
+      <path d="M 0,0 H 100 V 100 H 0 Z" id="svg2_path36" />
+    </clipPath>
+    <radialGradient fx="50.000641" fy="50.000641" cx="50.000641" cy="50.000641" r="50.000641" gradientUnits="userSpaceOnUse" id="svg2_radialGradient46">
+      <stop style="stop-opacity:1;stop-color:#ffffff" offset="0" id="svg2_stop40"></stop>
+      <stop style="stop-opacity:1;stop-color:#9999ff" offset="25.00032" id="svg2_stop42"></stop>
+      <stop style="stop-opacity:1;stop-color:#9999ff" offset="50.00064" id="svg2_stop44"></stop>
+    </radialGradient>
+  </defs>
+  <g id="svg2_g8" transform="matrix(1.3333333,0,0,-1.3333333,0,151.712)">
+    <g id="svg2_g10" transform="translate(-26.606,0.199)">
+      <g id="svg2_g12">
+        <g id="svg2_g14">
+          <g id="svg2_g16">
+            <g id="svg2_g18">
+              <g id="svg2_g20" clip-path="url(#svg2_clipPath24)">
+                <g id="svg2_g26" transform="matrix(2.26802,0,0,2.26802,113.38724,56.69362)">
+                  <g id="svg2_g28">
+                    <g id="svg2_g30" transform="translate(-50,-50)">
+                      <g id="svg2_g32">
+                        <g id="svg2_g34" clip-path="url(#svg2_clipPath38)">
+                          <path d="M 0,0 H 100 V 100 H 0 Z" style="fill:url(#svg2_radialGradient46);stroke:none" id="svg2_path48" />
+                        </g>
+                      </g>
+                    </g>
+                  </g>
+                </g>
+              </g>
+            </g>
+            <path d="M 56.69362,0 113.38724,113.38724 170.08086,0 Z" style="fill:none;stroke:#9999ff;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1" id="svg2_path50" />
+            <g id="svg2_g52">
+              <g id="svg2_g54" transform="translate(63.337,5.457)">
+                <g id="svg2_g56">
+                  <g id="svg2_g58" transform="translate(-36.731,-5.656)">
+                    <text xml:space="preserve" transform="matrix(1,0,0,-1,36.731,5.656)" style="font-variant:normal;font-weight:normal;font-size:9.9626px;font-family:CMSS10;-inkscape-font-specification:CMSS10;writing-mode:lr-tb;fill:#9999ff;fill-opacity:1;fill-rule:nonzero;stroke:none" id="svg2_text62"><tspan x="0 4.9812999 8.38552 13.173546 18.321222 20.701286 25.128666 30.27634 37.191383 41.010048 46.157722 50.945747 56.093422 60.520802 68.995987 72.593483 75.997704 78.377769 83.165794 88.303505 93.284805 95.664871" y="0" id="svg2_tspan60">gradientshadedtriangle</tspan></text>
+                    <g id="svg2_g64" transform="translate(36.731,5.656)"></g>
+                  </g>
+                </g>
+                <g id="svg2_g66" transform="translate(-63.337,-5.457)"></g>
+              </g>
+            </g>
+          </g>
+        </g>
+      </g>
+    </g>
+  </g>
+</svg></p>
+
+```
diff --git a/test/command/9467.svg b/test/command/9467.svg
new file mode 100644
--- /dev/null
+++ b/test/command/9467.svg
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-9" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   version="1.1" id="svg2" width="191.56267" height="151.71201" viewBox="0 0 191.56267 151.71201" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
+  <defs id="defs6">
+    <clipPath clipPathUnits="userSpaceOnUse" id="clipPath24">
+      <path d="M 56.69362,0 113.38724,113.38724 170.08086,0 Z" id="path22" />
+    </clipPath>
+    <clipPath clipPathUnits="userSpaceOnUse" id="clipPath38">
+      <path d="M 0,0 H 100 V 100 H 0 Z" id="path36" />
+    </clipPath>
+    <radialGradient fx="50.000641" fy="50.000641" cx="50.000641" cy="50.000641" r="50.000641" gradientUnits="userSpaceOnUse" id="radialGradient46">
+      <stop style="stop-opacity:1;stop-color:#ffffff" offset="0" id="stop40" />
+      <stop style="stop-opacity:1;stop-color:#9999ff" offset="25.00032" id="stop42" />
+      <stop style="stop-opacity:1;stop-color:#9999ff" offset="50.00064" id="stop44" />
+    </radialGradient>
+  </defs>
+  <g id="g8" transform="matrix(1.3333333,0,0,-1.3333333,0,151.712)">
+    <g id="g10" transform="translate(-26.606,0.199)">
+      <g id="g12">
+        <g id="g14">
+          <g id="g16">
+            <g id="g18">
+              <g id="g20" clip-path="url(#clipPath24)">
+                <g id="g26" transform="matrix(2.26802,0,0,2.26802,113.38724,56.69362)">
+                  <g id="g28">
+                    <g id="g30" transform="translate(-50,-50)">
+                      <g id="g32">
+                        <g id="g34" clip-path="url(#clipPath38)">
+                          <path d="M 0,0 H 100 V 100 H 0 Z" style="fill:url(#radialGradient46);stroke:none" id="path48" />
+                        </g>
+                      </g>
+                    </g>
+                  </g>
+                </g>
+              </g>
+            </g>
+            <path d="M 56.69362,0 113.38724,113.38724 170.08086,0 Z" style="fill:none;stroke:#9999ff;stroke-width:0.3985;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1" id="path50" />
+            <g id="g52">
+              <g id="g54" transform="translate(63.337,5.457)">
+                <g id="g56">
+                  <g id="g58" transform="translate(-36.731,-5.656)">
+                    <text xml:space="preserve" transform="matrix(1,0,0,-1,36.731,5.656)" style="font-variant:normal;font-weight:normal;font-size:9.9626px;font-family:CMSS10;-inkscape-font-specification:CMSS10;writing-mode:lr-tb;fill:#9999ff;fill-opacity:1;fill-rule:nonzero;stroke:none" id="text62"><tspan x="0 4.9812999 8.38552 13.173546 18.321222 20.701286 25.128666 30.27634 37.191383 41.010048 46.157722 50.945747 56.093422 60.520802 68.995987 72.593483 75.997704 78.377769 83.165794 88.303505 93.284805 95.664871" y="0" id="tspan60">gradientshadedtriangle</tspan></text>
+                    <g id="g64" transform="translate(36.731,5.656)" />
+                  </g>
+                </g>
+                <g id="g66" transform="translate(-63.337,-5.457)" />
+              </g>
+            </g>
+          </g>
+        </g>
+      </g>
+    </g>
+  </g>
+</svg>
