LaTeX reader: Add basic support for hyphenat package (#3603)

This commit is contained in:
schrieveslaach
2017-04-26 12:05:13 +02:00
committed by John MacFarlane
parent 256e3a6a5d
commit a29fa15a7b
2 changed files with 62 additions and 1 deletions
+13 -1
View File
@@ -518,7 +518,7 @@ inlineCommands = M.fromList $
, ("textmd", extractSpaces (spanWith ("",["medium"],[])) <$> tok)
, ("textrm", extractSpaces (spanWith ("",["roman"],[])) <$> tok)
, ("textup", extractSpaces (spanWith ("",["upright"],[])) <$> tok)
, ("texttt", (code . stringify . toList) <$> tok)
, ("texttt", ttfamily)
, ("sout", extractSpaces strikeout <$> tok)
, ("textsuperscript", extractSpaces superscript <$> tok)
, ("textsubscript", extractSpaces subscript <$> tok)
@@ -671,6 +671,15 @@ inlineCommands = M.fromList $
, ("hypertarget", braced >> tok)
-- siuntix
, ("SI", dosiunitx)
-- hyphenat
, ("bshyp", lit "\\\173")
, ("fshyp", lit "/\173")
, ("dothyp", lit ".\173")
, ("colonhyp", lit ":\173")
, ("hyp", lit "-")
, ("nohyphens", tok)
, ("textnhtt", ttfamily)
, ("nhttfamily", ttfamily)
] ++ map ignoreInlines
-- these commands will be ignored unless --parse-raw is specified,
-- in which case they will appear as raw latex blocks:
@@ -682,6 +691,9 @@ inlineCommands = M.fromList $
, "pagebreak"
]
ttfamily :: PandocMonad m => LP m Inlines
ttfamily = (code . stringify . toList) <$> tok
mkImage :: PandocMonad m => [(String, String)] -> String -> LP m Inlines
mkImage options src = do
let replaceTextwidth (k,v) = case numUnit v of
+49
View File
@@ -0,0 +1,49 @@
```
% pandoc -f latex -t native
electromagnetic\hyp{}endioscopy
^D
[Para [Str "electromagnetic-endioscopy"]]
```
```
% pandoc -f latex -t native
C\colonhyp\bshyp{}Windows\bshyp
^D
[Para [Str "C:\173\\\173Windows\\\173"]]
```
```
% pandoc -f latex -t native
\fshyp{}usr\fshyp{}share\fshyp
^D
[Para [Str "/\173usr/\173share/\173"]]
```
```
% pandoc -f latex -t native
\fshyp{}home\fshyp{}schrieveslaach\fshyp\dothyp{}m2
^D
[Para [Str "/\173home/\173schrieveslaach/\173.\173m2"]]
```
```
% pandoc -f latex -t native
\nohyphens{Pneumonoultramicroscopicsilicovolcanoconiosis}
^D
[Para [Str "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
```
```
% pandoc -f latex -t native
\textnhtt{Pneumonoultramicroscopicsilicovolcanoconiosis}
^D
[Para [Code ("",[],[]) "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
```
```
% pandoc -f latex -t native
\nhttfamily{Pneumonoultramicroscopicsilicovolcanoconiosis}
^D
[Para [Code ("",[],[]) "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
```