From 56051c8ac36ec02ce17e17faa79d250f8ee7f5ff Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 7 Jul 2022 22:56:02 +0200
Subject: [PATCH] RTF reader: support `\nosupersub`.

Closes #8170.
---
 src/Text/Pandoc/Readers/RTF.hs |  3 +++
 test/command/8170.md           | 15 +++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 test/command/8170.md

diff --git a/src/Text/Pandoc/Readers/RTF.hs b/src/Text/Pandoc/Readers/RTF.hs
index e781a9a09..c29a33b32 100644
--- a/src/Text/Pandoc/Readers/RTF.hs
+++ b/src/Text/Pandoc/Readers/RTF.hs
@@ -590,6 +590,9 @@ processTok bs (Tok pos tok') = do
       modifyGroup (\g -> g{ gSub = boolParam mbp })
     ControlWord "super" mbp -> bs <$
       modifyGroup (\g -> g{ gSuper = boolParam mbp })
+    ControlWord "nosupersub" mbp -> bs <$
+      modifyGroup (\g -> g{ gSuper = not $ boolParam mbp
+                          , gSub = not $ boolParam mbp })
     ControlWord "up" mbp -> bs <$
       modifyGroup (\g -> g{ gSuper = boolParam mbp })
     ControlWord "strike" mbp -> bs <$
diff --git a/test/command/8170.md b/test/command/8170.md
new file mode 100644
index 000000000..02485ac94
--- /dev/null
+++ b/test/command/8170.md
@@ -0,0 +1,15 @@
+```
+% pandoc -f rtf -t html
+{\rtf1\ansi\ansicpg1252\cocoartf2638
+\cocoascreenfonts1\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\froman\fcharset0 Times-Roman;}
+{\colortbl;\red255\green255\blue255;}
+{\*\expandedcolortbl;;}
+\margl1440\margr1440\vieww16800\viewh17280\viewkind0
+\pard\tx1080\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li180\fi440\sa120\pardirnatural\partightenfactor0
+
+\f0\fs34 \cf0 In 5
+\fs20 \super th
+\fs34 \nosupersub  grade I found a bug.}
+^D
+<p>In 5<sup>th</sup> grade I found a bug.</p>
+```