public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Cc: Andrew Voelkel
	<jandyman.voelkel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: Creating "Figure" style in docx output
Date: Sat, 10 Jul 2021 11:35:48 +0200	[thread overview]
Message-ID: <CADAJKhBH6HMHq_L4ihS2dU-H0H2-iPQ+g9cZLMcUR72dGSn_7g@mail.gmail.com> (raw)
In-Reply-To: <CADAJKhCRfXYXZUUDSFpD2k=mZNDHj-Pj0O7ozf0Sz6ctKHNQdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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

Sorry, if you add that Vim-highlight thing to your
`~/.vim/after/ftplugin/markdown.vim` or somewhere else permanent it should
be

``````vim
if !exists('b:backslash_space_hl')
    let b:
backslash_space_hl=matchadd('Search','\\  \?$')
endif
``````


Den lör 10 juli 2021 11:23BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> A couple of things:
>
> The trailing backslash has to be followed by a space character, i.e.
> `\<space><newline>` which will give you a no-break space at the end of the
> paragraph, which is distinct from `\<newline>` which will give you a soft
> line break. In Vim you can say `:let
> b:backslash_space_hl=matchadd('Search','\\ \?$')` to make them more visible
> and distinguishable in the current window. You might want to add that to
> `~/.vim/after/ftplugin/markdown.vim`. Other editors may or may not offer
> anything similar.
>
> The trick John mentions to style a paragraph with an image without a
> caption as Figure in DOCX output merits some explanation. It should look
> like this:
>
> ``````markdown
> :::{custom-style=Figure}
> ![](path/to/image.ext)\<space>
> :::
> ``````
>
> where the lines with backticks are not part of the syntax and `<space>` is
> a literal space character.
>
> HTH,
>
> /bpj
>
> Den lör 10 juli 2021 05:16John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> skrev:
>
>>
>> Sorry, it won't actually work for an image.
>>
>> Does the style need to be on the image, though, or on the
>> paragraph containing it? In the latter case using a fenced
>> div with custom-style attribute might work.
>>
>> There is documentation in the manual under --reference-doc
>> that tells you which styles pandoc uses (thus, which ones
>> you can modify in the reference.docx).
>>
>> If you want to add other styles to the reference.docx,
>> you'll need to use custom-style explicitly to access them.
>>
>>
>> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>>
>> > As I understand it, you want an inline image and you also want it
>> > to have a special style, "Image".
>> >
>> > Have you looked in the manual under "custom styles"?
>> >
>> > You should be able to do
>> >
>> > ![my alt text](img.jpg){custom-style="Image"}\
>> >
>> >
>> >
>> > Andrew Voelkel <jandyman.voelkel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>> >
>> >> As far as I could tell, the trailing backslash solution didn’t seem to
>> work. I had created a Figure style in my docx template, and yet the figure
>> seemed to be the Normal style in the generated document
>> >>
>> >> So on a related note, and since most of my issues with Pandoc seem to
>> be related either understanding the mapping between Markdown and the docx
>> styles, two questions:
>> >>
>> >> Is there documentation anywhere that describes how markdown is mapped
>> to docx styles?
>> >> Is there a way to “debug” this? It seems that if the docx files that
>> Pandoc creates reference a style that doesn’t exist in the template, then
>> that style defaults to Normal when you open it in Word. So is there any way
>> or any output I could look at that tells me what Pandoc is “trying” to do?
>> >>
>> >> Pandoc seems to be a fantastic tool, I’m grateful for it and it looks
>> like it will solve a problem I have no other solution for. The biggest
>> stumbling block seems to be this docx style mapping. I wish I could avoid
>> needing docx output, but in this situation I cannot.
>> >>
>> >> - Andy
>> >>
>> >>> On Jul 9, 2021, at 11:45 AM, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
>> wrote:
>> >>>
>> >>>
>> >>> If you just want an inline image, then you need to make sure it's
>> >>> not by itself in the paragraph (that triggers implicit_figures).
>> >>> You can, as the manual suggests, follow it with a nonbreaking
>> >>> space or something.
>> >>>
>> >>> Andrew Voelkel <jandyman.voelkel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>> >>>
>> >>>> UPDATE: I discovered that I can get a centered image caption by
>> creating an
>> >>>> Image Caption style in the docx template. That's a big relief. But
>> I'd
>> >>>> still like to know how to get an uncaptioned image which emits the
>> image
>> >>>> into the docx with the Image style instead of the Normal style.
>> >>>> On Thursday, July 8, 2021 at 2:27:56 PM UTC-7 Andrew Voelkel wrote:
>> >>>>
>> >>>>> Pandoc newbie here. Very pleased with what I'm seeing for plain
>> text
>> >>>>> documents, including docx output using the reference-doc feature.
>> I've also
>> >>>>> succeeded in getting a figure in the docx output with a caption:
>> >>>>>
>> >>>>> ![caption](SystemDrawings.png){width=500px}
>> >>>>>
>> >>>>> It's problematic though since if I want a caption I want it
>> centered like
>> >>>>> the figure (I modified the Captioned Figure style to center, but
>> that
>> >>>>> doesn't center the actual caption, just the figure. It's a shame).
>> >>>>>
>> >>>>> So OK, I tried skipping the captions. I figured this would create a
>> figure
>> >>>>> with style Figure, but it doesn't, it seems to create the figure
>> with style
>> >>>>> Normal. Feels like I can't get there from here, but this seems like
>> such
>> >>>>> and obvious and normal thing to do that it surprises me. I've tried
>> the
>> >>>>> following, but neither works, they both create a figure with style
>> Normal.
>> >>>>>
>> >>>>> ![](SystemDrawings.png){width=500px}
>> >>>>> ![caption](SystemDrawings.png){width=500px} \
>> >>>>>
>> >>>>> Is there any way to solve this issue?
>> >>>>>
>> >>>>
>> >>>> --
>> >>>> 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/b8286c97-446d-48d0-9fd9-f095ef9168c4n%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/m2y2aesvue.fsf%40MacBook-Pro-2.hsd1.ca.comcast.net
>> .
>>
>

-- 
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/CADAJKhBH6HMHq_L4ihS2dU-H0H2-iPQ%2Bg9cZLMcUR72dGSn_7g%40mail.gmail.com.

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

      parent reply	other threads:[~2021-07-10  9:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 21:27 Andrew Voelkel
     [not found] ` <27d20656-ac79-4cb4-9a69-58422c2ea32dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-08 23:42   ` Andrew Voelkel
     [not found]     ` <b8286c97-446d-48d0-9fd9-f095ef9168c4n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-09 18:45       ` John MacFarlane
     [not found]         ` <m27dhztjgw.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-07-09 21:03           ` Andrew Voelkel
     [not found]             ` <FF0F8ECD-9441-429C-AF9A-423675B9B7E4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2021-07-10  3:10               ` John MacFarlane
     [not found]                 ` <m21r86uamg.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-07-10  3:15                   ` John MacFarlane
     [not found]                     ` <m2y2aesvue.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-07-10  9:23                       ` BPJ
     [not found]                         ` <CADAJKhCRfXYXZUUDSFpD2k=mZNDHj-Pj0O7ozf0Sz6ctKHNQdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-07-10  9:35                           ` BPJ [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADAJKhBH6HMHq_L4ihS2dU-H0H2-iPQ+g9cZLMcUR72dGSn_7g@mail.gmail.com \
    --to=melroch-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=jandyman.voelkel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).