public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* \VERB background
@ 2021-03-22  4:14 Matt Jolly
       [not found] ` <3329e1ec-5642-48fb-9b93-7d3e49b406d5n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Jolly @ 2021-03-22  4:14 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi All,

I've been asked to implement dark backgrounds for syntax highlighting and 
have come up with a theme based on breezedark that works well, however it 
interferes with inline syntax highlighting as I can't seem to find a way to 
redefine / configure `\VERB` to enable the defined background colour.

An example of this behaviour can be seen using the skylighting breezedark 
theme on the following markdown:

```
A line with `function update_post_thumbnail_cache( $wp_query = null )`{.php} 
inline code and syntax highlighting.

A line with `function update_post_thumbnail_cache( $wp_query = null )` 
inline code.
```

The first line has inline syntax highlighting enabled, but the background 
isn't applied (as expected at this point), but it makes the code hard to 
read. I've had a look over the fvextra documentation, and over the fancyvrb 
source, but haven't been able to work out the syntax to force a background 
in my preamble. Is there a good solution for this issue / have I missed 
something basic?

Thanks for your time!

-- 
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/3329e1ec-5642-48fb-9b93-7d3e49b406d5n%40googlegroups.com.

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

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

* Re: \VERB background
       [not found] ` <3329e1ec-5642-48fb-9b93-7d3e49b406d5n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-03-26 12:50   ` krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
  2021-03-29 17:57   ` John MacFarlane
  1 sibling, 0 replies; 5+ messages in thread
From: krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org @ 2021-03-26 12:50 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi, I had pretty good results with `lua-ul` package. It is entirely 
ignorant to quirks of verbatim text and commands (they dont like being in 
macros, cause some incompatibilities, etc ...)

Your best bet is actually not use \verb{}; but \texttt{}, which looks the 
same (monospaced font), but doesnt create issues.

With that being said, `lua-ul` can be used in both cases. Works the same as 
`soul` package - creates background under the text with specified color.

The downside is, for some, that it requires luaTeX (or LuaLaTeX) to work 
and also is probably in some sizeable-packages, if even. I install TeXlive 
manually (which is the recommended way anyway), so in that case I would 
recommend you doing the same.

Background highlighting in TeX is surprisingly tricky, If you want to avoid 
overlaping and have working line-breaking in the highlighted text, so there 
is not much alternatives. If you look very thouroughly through TeX SE, you 
will find some post I have found few years ago that is using TikZ and 
`atbegshi` for that ... But in long documents (few hundred pages) that adds 
up to compilation time. Also it is very advanced code (undebugable).

Dne pondělí 22. března 2021 v 5:14:03 UTC+1 uživatel Matt Jolly napsal:

> Hi All,
>
> I've been asked to implement dark backgrounds for syntax highlighting and 
> have come up with a theme based on breezedark that works well, however it 
> interferes with inline syntax highlighting as I can't seem to find a way to 
> redefine / configure `\VERB` to enable the defined background colour.
>
> An example of this behaviour can be seen using the skylighting breezedark 
> theme on the following markdown:
>
> ```
> A line with `function update_post_thumbnail_cache( $wp_query = null )`{.php} 
> inline code and syntax highlighting.
>
> A line with `function update_post_thumbnail_cache( $wp_query = null )` 
> inline code.
> ```
>
> The first line has inline syntax highlighting enabled, but the background 
> isn't applied (as expected at this point), but it makes the code hard to 
> read. I've had a look over the fvextra documentation, and over the fancyvrb 
> source, but haven't been able to work out the syntax to force a background 
> in my preamble. Is there a good solution for this issue / have I missed 
> something basic?
>
> Thanks for your time!
>
>

-- 
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/98df56f4-78f7-403f-a114-2a9679e51636n%40googlegroups.com.

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

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

* Re: \VERB background
       [not found] ` <3329e1ec-5642-48fb-9b93-7d3e49b406d5n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2021-03-26 12:50   ` krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
@ 2021-03-29 17:57   ` John MacFarlane
       [not found]     ` <m2tuotkfkv.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: John MacFarlane @ 2021-03-29 17:57 UTC (permalink / raw)
  To: Matt Jolly, pandoc-discuss


I can't remember whether this is something I simply didn't get
around to implementing, or whether there was some reason it
wasn't possible.

If you want, submit an issue to jgm/skylighting so we don't
lose track of the issue.  If I have time, I can look into
it further. It seems it should be possible to use one of
TeX's box commands to add the background color?

Matt Jolly <kangie-S+5N7tjWkgv8X0x+8FA6VA@public.gmane.org> writes:

> Hi All,
>
> I've been asked to implement dark backgrounds for syntax highlighting and 
> have come up with a theme based on breezedark that works well, however it 
> interferes with inline syntax highlighting as I can't seem to find a way to 
> redefine / configure `\VERB` to enable the defined background colour.
>
> An example of this behaviour can be seen using the skylighting breezedark 
> theme on the following markdown:
>
> ```
> A line with `function update_post_thumbnail_cache( $wp_query = null )`{.php} 
> inline code and syntax highlighting.
>
> A line with `function update_post_thumbnail_cache( $wp_query = null )` 
> inline code.
> ```
>
> The first line has inline syntax highlighting enabled, but the background 
> isn't applied (as expected at this point), but it makes the code hard to 
> read. I've had a look over the fvextra documentation, and over the fancyvrb 
> source, but haven't been able to work out the syntax to force a background 
> in my preamble. Is there a good solution for this issue / have I missed 
> something basic?
>
> Thanks for your time!
>
> -- 
> 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/3329e1ec-5642-48fb-9b93-7d3e49b406d5n%40googlegroups.com.


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

* Re: \VERB background
       [not found]     ` <m2tuotkfkv.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2021-04-02  8:36       ` krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
       [not found]         ` <bbc6a70f-e783-4550-bb0c-3ef6dfdcd094n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org @ 2021-04-02  8:36 UTC (permalink / raw)
  To: pandoc-discuss


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

I tryed this some time ago.

If I am not mistaken, `\verb` doesnt allow linebreaks within its argument. 
For that, I think that simple `\colorbox{color}{\verb{}}` should work ... 
What I tryed was to also maintain linebreaking, which is possible with 
`fancyvrb` commands, but is not working with `\colorbox{}{}`, and `soul` 
package had some incompatibilities too. Found a question I asked about that 
some time ago: 

https://tex.stackexchange.com/questions/522143/verb-in-fvextra-highlighting-verb-text-to-be-able-to-break-at-the-end-of

Because I am running LuaLaTeX all the time I have discovered package 
`lua-ul` which is working in all situations, but I would be surprised if it 
would be available in other than official TeXlive repositories ...
Dne pondělí 29. března 2021 v 19:58:07 UTC+2 uživatel John MacFarlane 
napsal:

>
> I can't remember whether this is something I simply didn't get
> around to implementing, or whether there was some reason it
> wasn't possible.
>
> If you want, submit an issue to jgm/skylighting so we don't
> lose track of the issue. If I have time, I can look into
> it further. It seems it should be possible to use one of
> TeX's box commands to add the background color?
>
> Matt Jolly <kan...-S+5N7tjWkgv8X0x+8FA6VA@public.gmane.org> writes:
>
> > Hi All,
> >
> > I've been asked to implement dark backgrounds for syntax highlighting 
> and 
> > have come up with a theme based on breezedark that works well, however 
> it 
> > interferes with inline syntax highlighting as I can't seem to find a way 
> to 
> > redefine / configure `\VERB` to enable the defined background colour.
> >
> > An example of this behaviour can be seen using the skylighting 
> breezedark 
> > theme on the following markdown:
> >
> > ```
> > A line with `function update_post_thumbnail_cache( $wp_query = null 
> )`{.php} 
> > inline code and syntax highlighting.
> >
> > A line with `function update_post_thumbnail_cache( $wp_query = null )` 
> > inline code.
> > ```
> >
> > The first line has inline syntax highlighting enabled, but the 
> background 
> > isn't applied (as expected at this point), but it makes the code hard to 
> > read. I've had a look over the fvextra documentation, and over the 
> fancyvrb 
> > source, but haven't been able to work out the syntax to force a 
> background 
> > in my preamble. Is there a good solution for this issue / have I missed 
> > something basic?
> >
> > Thanks for your time!
> >
> > -- 
> > 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/3329e1ec-5642-48fb-9b93-7d3e49b406d5n%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/bbc6a70f-e783-4550-bb0c-3ef6dfdcd094n%40googlegroups.com.

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

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

* Re: \VERB background
       [not found]         ` <bbc6a70f-e783-4550-bb0c-3ef6dfdcd094n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-04-02 18:54           ` BPJ
  0 siblings, 0 replies; 5+ messages in thread
From: BPJ @ 2021-04-02 18:54 UTC (permalink / raw)
  To: pandoc-discuss

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

Somewhat to my surprise Pandoc uses `\texttt` when no highlighting is
requested but `\VERB` when highlighting is requested. Anyway enclosing a
Code element in the raw LaTeX markup for a `\colorbox` does, if I remember
correctly, work. You can use my general filter for colorizing spans through
attributes[^1] or use a bespoke Lua filter to insert some variation on
`pandoc.RawInline('latex', '\\colorbox[<model>]{<color>}{')` before the
Code element and `pandooc.RawInline('latex','}')` after it. I guess I could
add direct support for Code elements to my filter, although setting the
foreground color through doesn't make much sense when you use highlighting.
(BTW I have a fix for issue #5 ready. I will probably push it tomorrow.)

[^1]: https://github.com/bpj/pandoc-attr-color

Den fre 2 apr. 2021 10:36krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <krulis.tomas.tk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
skrev:

> I tryed this some time ago.
>
> If I am not mistaken, `\verb` doesnt allow linebreaks within its argument.
> For that, I think that simple `\colorbox{color}{\verb{}}` should work ...
> What I tryed was to also maintain linebreaking, which is possible with
> `fancyvrb` commands, but is not working with `\colorbox{}{}`, and `soul`
> package had some incompatibilities too. Found a question I asked about that
> some time ago:
>
>
> https://tex.stackexchange.com/questions/522143/verb-in-fvextra-highlighting-verb-text-to-be-able-to-break-at-the-end-of
>
> Because I am running LuaLaTeX all the time I have discovered package
> `lua-ul` which is working in all situations, but I would be surprised if it
> would be available in other than official TeXlive repositories ...
> Dne pondělí 29. března 2021 v 19:58:07 UTC+2 uživatel John MacFarlane
> napsal:
>
>>
>> I can't remember whether this is something I simply didn't get
>> around to implementing, or whether there was some reason it
>> wasn't possible.
>>
>> If you want, submit an issue to jgm/skylighting so we don't
>> lose track of the issue. If I have time, I can look into
>> it further. It seems it should be possible to use one of
>> TeX's box commands to add the background color?
>>
>> Matt Jolly <kan...-S+5N7tjWkgv8X0x+8FA6VA@public.gmane.org> writes:
>>
>> > Hi All,
>> >
>> > I've been asked to implement dark backgrounds for syntax highlighting
>> and
>> > have come up with a theme based on breezedark that works well, however
>> it
>> > interferes with inline syntax highlighting as I can't seem to find a
>> way to
>> > redefine / configure `\VERB` to enable the defined background colour.
>> >
>> > An example of this behaviour can be seen using the skylighting
>> breezedark
>> > theme on the following markdown:
>> >
>> > ```
>> > A line with `function update_post_thumbnail_cache( $wp_query = null
>> )`{.php}
>> > inline code and syntax highlighting.
>> >
>> > A line with `function update_post_thumbnail_cache( $wp_query = null )`
>> > inline code.
>> > ```
>> >
>> > The first line has inline syntax highlighting enabled, but the
>> background
>> > isn't applied (as expected at this point), but it makes the code hard
>> to
>> > read. I've had a look over the fvextra documentation, and over the
>> fancyvrb
>> > source, but haven't been able to work out the syntax to force a
>> background
>> > in my preamble. Is there a good solution for this issue / have I missed
>> > something basic?
>> >
>> > Thanks for your time!
>> >
>> > --
>> > 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/3329e1ec-5642-48fb-9b93-7d3e49b406d5n%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/bbc6a70f-e783-4550-bb0c-3ef6dfdcd094n%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/bbc6a70f-e783-4550-bb0c-3ef6dfdcd094n%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/CADAJKhDOsh9nS9d5752Si1AQyCt4fB60SDatcg%3DkjTXmAW2wfw%40mail.gmail.com.

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

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

end of thread, other threads:[~2021-04-02 18:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22  4:14 \VERB background Matt Jolly
     [not found] ` <3329e1ec-5642-48fb-9b93-7d3e49b406d5n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-03-26 12:50   ` krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2021-03-29 17:57   ` John MacFarlane
     [not found]     ` <m2tuotkfkv.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2021-04-02  8:36       ` krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
     [not found]         ` <bbc6a70f-e783-4550-bb0c-3ef6dfdcd094n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-04-02 18:54           ` BPJ

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