public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* No indent after horizontal rule
@ 2021-08-16 14:03 ` Ian Barnes
       [not found]   ` <9953168b-aa53-4c75-b18b-612ddd8a3ddfn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Barnes @ 2021-08-16 14:03 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2033 bytes --]

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-discuss+unsubscribe-/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.

[-- Attachment #1.2: Type: text/html, Size: 3409 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: No indent after horizontal rule
       [not found]   ` <9953168b-aa53-4c75-b18b-612ddd8a3ddfn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-08-16 16:52     ` John MacFarlane
       [not found]       ` <m2im05s56x.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: John MacFarlane @ 2021-08-16 16:52 UTC (permalink / raw)
  To: Ian Barnes, pandoc-discuss


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 <ianbarnes1963-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-discuss+unsubscribe-/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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: No indent after horizontal rule
       [not found]       ` <m2im05s56x.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
@ 2021-08-17 23:02         ` Ian Barnes
       [not found]           ` <945bf0d5-b826-4446-a086-0b1120824e80n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Barnes @ 2021-08-17 23:02 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3755 bytes --]

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 <ianbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.

[-- Attachment #1.2: Type: text/html, Size: 5390 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* AW: No indent after horizontal rule
       [not found]           ` <945bf0d5-b826-4446-a086-0b1120824e80n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-08-18  7:12             ` denis.maier-NSENcxR/0n0
       [not found]               ` <23250a1cbd394d0487439d89bf180814-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2021-08-18  7:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 4884 bytes --]

Just a quick note: there’s also the the noindentafter package: https://www.ctan.org/pkg/noindentafter

Might be an idea to look into how this package implements this.

Best
Denis

Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von Ian Barnes
Gesendet: Mittwoch, 18. August 2021 01:02
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
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<file://begin%7bcenter%7d/rule%7b0.5/linewidth%7d%7b0.5pt%7d/end%7bcenter%7d/noindent>"
fixhrule x = x


Ian Barnes <ianbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 <file://noindent%20> ") : 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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<https://groups.google.com/d/msgid/pandoc-discuss/945bf0d5-b826-4446-a086-0b1120824e80n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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.

[-- Attachment #2: Type: text/html, Size: 9547 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: No indent after horizontal rule
       [not found]               ` <23250a1cbd394d0487439d89bf180814-NSENcxR/0n0@public.gmane.org>
@ 2021-08-18  7:29                 ` Ian Barnes
       [not found]                   ` <a2305a76-f1a6-420a-a589-f0a95a7fecb3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2021-08-18  8:13                 ` BPJ
  2021-08-22  8:36                 ` Ian Barnes
  2 siblings, 1 reply; 9+ messages in thread
From: Ian Barnes @ 2021-08-18  7:29 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 5366 bytes --]

@Denis, thanks, cool, I'll have a look.

Unrelated question. When I compiled my dozen lines or so of Haskell filter 
to an executable, the result was 20MB. Is that normal?

On Wednesday, 18 August 2021 at 9:12:39 am UTC+2 denis...-NSENcxR/0n0@public.gmane.org wrote:

> Just a quick note: there’s also the the noindentafter package: 
> https://www.ctan.org/pkg/noindentafter
>
>  
>
> Might be an idea to look into how this package implements this.
>
>  
>
> Best
>
> Denis
>
>  
>
> *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *Ian Barnes
> *Gesendet:* Mittwoch, 18. August 2021 01:02
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 <ianbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-discus...-/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 
> <https://groups.google.com/d/msgid/pandoc-discuss/945bf0d5-b826-4446-a086-0b1120824e80n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/a2305a76-f1a6-420a-a589-f0a95a7fecb3n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 9924 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: No indent after horizontal rule
       [not found]               ` <23250a1cbd394d0487439d89bf180814-NSENcxR/0n0@public.gmane.org>
  2021-08-18  7:29                 ` Ian Barnes
@ 2021-08-18  8:13                 ` BPJ
  2021-08-22  8:36                 ` Ian Barnes
  2 siblings, 0 replies; 9+ messages in thread
From: BPJ @ 2021-08-18  8:13 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 5785 bytes --]

Den ons 18 aug. 2021 09:13 <denis.maier-NSENcxR/0n0@public.gmane.org> 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 <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
> Auftrag von *Ian Barnes
> *Gesendet:* Mittwoch, 18. August 2021 01:02
> *An:* pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 <ianbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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
> <https://groups.google.com/d/msgid/pandoc-discuss/945bf0d5-b826-4446-a086-0b1120824e80n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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
> <https://groups.google.com/d/msgid/pandoc-discuss/23250a1cbd394d0487439d89bf180814%40unibe.ch?utm_medium=email&utm_source=footer>
> .
>

-- 
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.

[-- Attachment #2: Type: text/html, Size: 10342 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: No indent after horizontal rule
       [not found]               ` <23250a1cbd394d0487439d89bf180814-NSENcxR/0n0@public.gmane.org>
  2021-08-18  7:29                 ` Ian Barnes
  2021-08-18  8:13                 ` BPJ
@ 2021-08-22  8:36                 ` Ian Barnes
  2 siblings, 0 replies; 9+ messages in thread
From: Ian Barnes @ 2021-08-22  8:36 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 5636 bytes --]

Tried this. Added
  header-includes: |
    \usepackage{noindentafter}
    \NoIndentAfterEnv{center}
to my defaults.yml. Didn't work... Checked what's going on with --verbose, 
and I see this:
Package noindentafter Warning: Patching `\end' failed!
(noindentafter)                `\NoIndentAfter...' commands won't work.
I'm not enough of a TeX wizard to take that any further. Still, we have two 
working solutions, so I'm pretty happy.

On Wednesday, 18 August 2021 at 9:12:39 am UTC+2 denis...-NSENcxR/0n0@public.gmane.org wrote:

> Just a quick note: there’s also the the noindentafter package: 
> https://www.ctan.org/pkg/noindentafter
>
>  
>
> Might be an idea to look into how this package implements this.
>
>  
>
> Best
>
> Denis
>
>  
>
> *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *Ian Barnes
> *Gesendet:* Mittwoch, 18. August 2021 01:02
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 <ianbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-discus...-/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 
> <https://groups.google.com/d/msgid/pandoc-discuss/945bf0d5-b826-4446-a086-0b1120824e80n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/909956f8-f1b2-4558-9697-a66079650466n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 10531 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: No indent after horizontal rule
       [not found]                   ` <a2305a76-f1a6-420a-a589-f0a95a7fecb3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-08-22  8:39                     ` Ian Barnes
       [not found]                       ` <acf9a5d3-ff84-404b-8b3b-9d152b5f4621n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Barnes @ 2021-08-22  8:39 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 6059 bytes --]

I was curious, so I tried this. Added

  header-includes: |
    \usepackage{noindentafter}
    \NoIndentAfterEnv{center}

to my defaults.yml. Didn't work... Checked what's going on with --verbose, 
and I see this:

Package noindentafter Warning: Patching `\end' failed!
(noindentafter)                `\NoIndentAfter...' commands won't work.

I'm not enough of a TeX wizard to take that any further. Still, we have two 
working solutions, so I'm pretty happy.

On Wednesday, 18 August 2021 at 9:29:13 am UTC+2 Ian Barnes wrote:

> @Denis, thanks, cool, I'll have a look.
>
> Unrelated question. When I compiled my dozen lines or so of Haskell filter 
> to an executable, the result was 20MB. Is that normal?
>
> On Wednesday, 18 August 2021 at 9:12:39 am UTC+2 denis...-NSENcxR/0n0@public.gmane.org wrote:
>
>> Just a quick note: there’s also the the noindentafter package: 
>> https://www.ctan.org/pkg/noindentafter
>>
>>  
>>
>> Might be an idea to look into how this package implements this.
>>
>>  
>>
>> Best
>>
>> Denis
>>
>>  
>>
>> *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
>> Auftrag von *Ian Barnes
>> *Gesendet:* Mittwoch, 18. August 2021 01:02
>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>> *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 <ianbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-discus...-/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 
>> <https://groups.google.com/d/msgid/pandoc-discuss/945bf0d5-b826-4446-a086-0b1120824e80n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/acf9a5d3-ff84-404b-8b3b-9d152b5f4621n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 11056 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* AW: No indent after horizontal rule
       [not found]                       ` <acf9a5d3-ff84-404b-8b3b-9d152b5f4621n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-08-23  9:14                         ` denis.maier-NSENcxR/0n0
  0 siblings, 0 replies; 9+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2021-08-23  9:14 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 6959 bytes --]

That mostly likely means that the noindentafter package is outdated. I’ve had the same error. It worked again after updating this package.

Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von Ian Barnes
Gesendet: Sonntag, 22. August 2021 10:40
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Re: No indent after horizontal rule

I was curious, so I tried this. Added

  header-includes: |
    \usepackage{noindentafter}
    \NoIndentAfterEnv{center}

to my defaults.yml. Didn't work... Checked what's going on with --verbose, and I see this:

Package noindentafter Warning: Patching `\end' failed!
(noindentafter)                `\NoIndentAfter...' commands won't work.

I'm not enough of a TeX wizard to take that any further. Still, we have two working solutions, so I'm pretty happy.

On Wednesday, 18 August 2021 at 9:29:13 am UTC+2 Ian Barnes wrote:
@Denis, thanks, cool, I'll have a look.

Unrelated question. When I compiled my dozen lines or so of Haskell filter to an executable, the result was 20MB. Is that normal?
On Wednesday, 18 August 2021 at 9:12:39 am UTC+2 denis...-NSENcxR/0n0@public.gmane.org wrote:
Just a quick note: there’s also the the noindentafter package: https://www.ctan.org/pkg/noindentafter

Might be an idea to look into how this package implements this.

Best
Denis

Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>> Im Auftrag von Ian Barnes
Gesendet: Mittwoch, 18. August 2021 01:02
An: pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-...@googlegroups.com>>
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<file://begin%7bcenter%7d/rule%7b0.5/linewidth%7d%7b0.5pt%7d/end%7bcenter%7d/noindent>"
fixhrule x = x


Ian Barnes <ianbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org<mailto:ianbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> 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 <file://noindent%20> ") : 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...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discus...@googlegroups.com>.
> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discus...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/945bf0d5-b826-4446-a086-0b1120824e80n%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/945bf0d5-b826-4446-a086-0b1120824e80n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/acf9a5d3-ff84-404b-8b3b-9d152b5f4621n%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/acf9a5d3-ff84-404b-8b3b-9d152b5f4621n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/aa9f195dff39478689bfdbd630d5f6bb%40unibe.ch.

[-- Attachment #2: Type: text/html, Size: 15483 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-23  9:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AQHXkr8WZu2wiXXT3kiqv6VEeWbF9qt4MMqAgACqNhA=>
2021-08-16 14:03 ` No indent after horizontal rule Ian Barnes
     [not found]   ` <9953168b-aa53-4c75-b18b-612ddd8a3ddfn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-16 16:52     ` John MacFarlane
     [not found]       ` <m2im05s56x.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-08-17 23:02         ` Ian Barnes
     [not found]           ` <945bf0d5-b826-4446-a086-0b1120824e80n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-18  7:12             ` AW: " denis.maier-NSENcxR/0n0
     [not found]               ` <23250a1cbd394d0487439d89bf180814-NSENcxR/0n0@public.gmane.org>
2021-08-18  7:29                 ` Ian Barnes
     [not found]                   ` <a2305a76-f1a6-420a-a589-f0a95a7fecb3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-22  8:39                     ` Ian Barnes
     [not found]                       ` <acf9a5d3-ff84-404b-8b3b-9d152b5f4621n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-23  9:14                         ` AW: " denis.maier-NSENcxR/0n0
2021-08-18  8:13                 ` BPJ
2021-08-22  8:36                 ` Ian Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).