Den ons 18 aug. 2021 09:13 skrev: > Just a quick note: there’s also the the noindentafter package: > https://www.ctan.org/pkg/noindentafter > It seems there is always a package which does what you want if only you know what search term to use! > > Might be an idea to look into how this package implements this. > > > > Best > > Denis > > > > *Von:* pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org *Im > Auftrag von *Ian Barnes > *Gesendet:* Mittwoch, 18. August 2021 01:02 > *An:* pandoc-discuss > *Betreff:* Re: No indent after horizontal rule > > > > Thanks for the response. Yes, I agree that's simpler and I tried something > like that first too, but it failed on my first attempt. TeX just ignores > the \noindent, because there's a blank line between it and the following > paragraph in the generated TeX file. But I went back to it just now and it > works if you add something like this > > > > \makeatletter > > \def\gobblepar{\@ifnextchar\par\@gobble\relax} > > \makeatother > > > > to your template or header-includes and then stick a \gobblepar after the > \noindent. I'm a little concerned about what this does if the block after > the hrule isn't a paragraph. Seems to result in extra vertical space. But > that seems kind-of a perverse thing for a document author to do. > > > > Interesting, thanks, that was fun... > > On Monday, 16 August 2021 at 6:52:21 pm UTC+2 John MacFarlane wrote: > > > The most straightforward approach would probably just be > > fixhrule :: Block -> Block > fixhrule HorizontalRule = > RawBlock (Format "latex") " > \\begin{center}\\rule{0.5\\linewidth}{0.5pt}\\end{center}\\noindent" > fixhrule x = x > > > Ian Barnes writes: > > > It's not quite the same situation as the various discussions about not > > wanting indents after blockquotes, but similar enough that perhaps my > > solution is interesting for others. > > > > I'm converting Markdown to PDF via LaTeX, with indent:true, and I'm > using > > horizontal rules as scene or section breaks. I found the indent on the > > first paragraph after such a break ugly and wanted to do an automatic > > \noindent after every horizontal rule. This turned out to be pretty easy > > with a Haskell filter. > > > > As it's the first time I've written anything in Haskell, I thought I'd > post > > it here for feedback. Seems to me like maybe there's a more concise way > to > > do the same thing. > > > > Also this could obviously be adapted to actually remove the horizontal > > rules and replace them with the Pandoc internal representation of a > > vertical skip or blank line (whatever that is). > > > > import Data.Text > > import Text.Pandoc.JSON > > > > main :: IO () > > main = toJSONFilter noIndentAfterHorizontalRule > > > > noIndentAfterHorizontalRule :: Pandoc -> Pandoc > > noIndentAfterHorizontalRule doc = > > let Pandoc meta blocks = doc > > in Pandoc meta (mapAfterHorizontalRule noIndentifyPara blocks) > > > > mapAfterHorizontalRule :: (Block -> Block) -> [Block] -> [Block] > > mapAfterHorizontalRule f (HorizontalRule : block : blocks) = > > HorizontalRule : f block : mapAfterHorizontalRule f blocks > > mapAfterHorizontalRule f (block : blocks) = block : > mapAfterHorizontalRule > > f blocks > > mapAfterHorizontalRule f [] = [] > > > > noIndentifyPara :: Block -> Block > > noIndentifyPara (Para xs) = > > Para (RawInline (Format (Data.Text.pack "tex")) (Data.Text.pack > > "\\noindent ") : xs) > > noIndentifyPara x = x > > > > -- > > You received this message because you are subscribed to the Google > Groups "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/9953168b-aa53-4c75-b18b-612ddd8a3ddfn%40googlegroups.com. > > > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/945bf0d5-b826-4446-a086-0b1120824e80n%40googlegroups.com > > . > > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/23250a1cbd394d0487439d89bf180814%40unibe.ch > > . > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDwSzNZSMPjBNBaFndkqnUnWM9%3DXNdEJ6yO%3DTZAqyRANQ%40mail.gmail.com.