public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Define LaTeX macros for normal text?
@ 2018-07-20  8:28 Axel Rauschmayer
       [not found] ` <58f781fb-4f67-40df-8567-847f62b54d35-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Axel Rauschmayer @ 2018-07-20  8:28 UTC (permalink / raw)
  To: pandoc-discuss


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

I have the following use case: In LaTeX, \path{} is great for breaking up 
long paths and URLs in PDFs, so that they don’t overflow into the margins.

For example:

* You can open the following file inside the repository with the exercises: 
\path{demos/async-js/blocking.html}

But I don’t know how to make this work for HTML (apart from pre-processing 
via sed). One theoretical possibility (conditionally switched on if the 
target format is HTML):

\newcommand{\path}[1]{<code>#1</code>}

Alas, that only seems to work in math context.

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/58f781fb-4f67-40df-8567-847f62b54d35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Define LaTeX macros for normal text?
       [not found] ` <58f781fb-4f67-40df-8567-847f62b54d35-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-07-20 12:23   ` mb21
       [not found]     ` <e613795f-c063-4b39-890d-2a33684d9054-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2018-07-21  7:32   ` Axel Rauschmayer
  1 sibling, 1 reply; 6+ messages in thread
From: mb21 @ 2018-07-20 12:23 UTC (permalink / raw)
  To: pandoc-discuss


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

Add this CSS to your HTML template or via header-includes YAML metadata:

code {
  overflow-wrap: break-word;
}

see https://css-tricks.com/almanac/properties/o/overflow-wrap/


On Friday, July 20, 2018 at 10:28:01 AM UTC+2, Axel Rauschmayer wrote:
>
> I have the following use case: In LaTeX, \path{} is great for breaking up 
> long paths and URLs in PDFs, so that they don’t overflow into the margins.
>
> For example:
>
> * You can open the following file inside the repository with the 
> exercises: \path{demos/async-js/blocking.html}
>
> But I don’t know how to make this work for HTML (apart from pre-processing 
> via sed). One theoretical possibility (conditionally switched on if the 
> target format is HTML):
>
> \newcommand{\path}[1]{<code>#1</code>}
>
> Alas, that only seems to work in math context.
>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e613795f-c063-4b39-890d-2a33684d9054%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Define LaTeX macros for normal text?
       [not found]     ` <e613795f-c063-4b39-890d-2a33684d9054-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-07-20 12:29       ` Axel Rauschmayer
       [not found]         ` <25a92052-57c8-40e9-b51e-881285edefb2-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Axel Rauschmayer @ 2018-07-20 12:29 UTC (permalink / raw)
  To: pandoc-discuss


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

Thanks! But my problem is more about getting from (Markdown):

\path{this/is/a/long/path}

to (HTML):

<code>this/is/a/long/path</code>

when converting Markdown to HTML (going from Markdown to LaTeX is fine, 
obviously).


On Friday, July 20, 2018 at 2:23:17 PM UTC+2, mb21 wrote:
>
> Add this CSS to your HTML template or via header-includes YAML metadata:
>
> code {
>   overflow-wrap: break-word;
> }
>
> see https://css-tricks.com/almanac/properties/o/overflow-wrap/
>
>
> On Friday, July 20, 2018 at 10:28:01 AM UTC+2, Axel Rauschmayer wrote:
>>
>> I have the following use case: In LaTeX, \path{} is great for breaking 
>> up long paths and URLs in PDFs, so that they don’t overflow into the 
>> margins.
>>
>> For example:
>>
>> * You can open the following file inside the repository with the 
>> exercises: \path{demos/async-js/blocking.html}
>>
>> But I don’t know how to make this work for HTML (apart from 
>> pre-processing via sed). One theoretical possibility (conditionally 
>> switched on if the target format is HTML):
>>
>> \newcommand{\path}[1]{<code>#1</code>}
>>
>> Alas, that only seems to work in math context.
>>
>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/25a92052-57c8-40e9-b51e-881285edefb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Define LaTeX macros for normal text?
       [not found]         ` <25a92052-57c8-40e9-b51e-881285edefb2-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-07-20 17:24           ` John MacFarlane
       [not found]             ` <yh480kva99zupz.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: John MacFarlane @ 2018-07-20 17:24 UTC (permalink / raw)
  To: Axel Rauschmayer, pandoc-discuss


You could use a lua filter to intercept the raw latex
\path{} commands and convert them to pandoc Code inlines.

Axel Rauschmayer <rauschma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Thanks! But my problem is more about getting from (Markdown):
>
> \path{this/is/a/long/path}
>
> to (HTML):
>
> <code>this/is/a/long/path</code>
>
> when converting Markdown to HTML (going from Markdown to LaTeX is fine, 
> obviously).


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

* Re: Define LaTeX macros for normal text?
       [not found]             ` <yh480kva99zupz.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2018-07-20 19:52               ` Axel Rauschmayer
  0 siblings, 0 replies; 6+ messages in thread
From: Axel Rauschmayer @ 2018-07-20 19:52 UTC (permalink / raw)
  To: pandoc-discuss


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

That makes sense. Thanks, John!

On Friday, July 20, 2018 at 7:24:24 PM UTC+2, John MacFarlane wrote:
>
>
> You could use a lua filter to intercept the raw latex 
> \path{} commands and convert them to pandoc Code inlines. 
>
> Axel Rauschmayer <raus...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> writes: 
>
> > Thanks! But my problem is more about getting from (Markdown): 
> > 
> > \path{this/is/a/long/path} 
> > 
> > to (HTML): 
> > 
> > <code>this/is/a/long/path</code> 
> > 
> > when converting Markdown to HTML (going from Markdown to LaTeX is fine, 
> > obviously). 
>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8a6f750b-ba0b-4cb8-932c-1030cd8979ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Define LaTeX macros for normal text?
       [not found] ` <58f781fb-4f67-40df-8567-847f62b54d35-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2018-07-20 12:23   ` mb21
@ 2018-07-21  7:32   ` Axel Rauschmayer
  1 sibling, 0 replies; 6+ messages in thread
From: Axel Rauschmayer @ 2018-07-21  7:32 UTC (permalink / raw)
  To: pandoc-discuss


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

In case anyone reads this thread in the future – this is the code for a Lua 
filter that solves my issue:

-- pandoc -t html --lua-filter=path_to_code.lua testfile.md

function RawInline(el)
  if (el.format == "tex") then
    local inner = string.match(el.text, "\\path{([^}]*)}")
    return pandoc.Code(inner)
  else
    return el
  end
end

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/80678060-b639-493a-8ab9-3b34d44a2549%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

end of thread, other threads:[~2018-07-21  7:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20  8:28 Define LaTeX macros for normal text? Axel Rauschmayer
     [not found] ` <58f781fb-4f67-40df-8567-847f62b54d35-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-20 12:23   ` mb21
     [not found]     ` <e613795f-c063-4b39-890d-2a33684d9054-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-20 12:29       ` Axel Rauschmayer
     [not found]         ` <25a92052-57c8-40e9-b51e-881285edefb2-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-20 17:24           ` John MacFarlane
     [not found]             ` <yh480kva99zupz.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-07-20 19:52               ` Axel Rauschmayer
2018-07-21  7:32   ` Axel Rauschmayer

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