* Unable to center text in Markdown @ 2022-10-11 14:39 Richard Hu [not found] ` <5466ba6b-31e3-4288-a86b-32463bdefe32n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Richard Hu @ 2022-10-11 14:39 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 724 bytes --] Hello! I'm trying to center some text in my markdown document. I've tried: ``` <p align="center"> Sample Text </p> <center> Sample Text </p> ``` And used `pandoc test.md -o test.pdf` to compile my document. However, the text shows up as left-aligned and not centered. How may I resolve this issue? Thank you. -- 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/5466ba6b-31e3-4288-a86b-32463bdefe32n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 1173 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <5466ba6b-31e3-4288-a86b-32463bdefe32n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Unable to center text in Markdown [not found] ` <5466ba6b-31e3-4288-a86b-32463bdefe32n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-10-11 14:44 ` Craig Parker 2022-10-11 18:27 ` gnpan 1 sibling, 0 replies; 5+ messages in thread From: Craig Parker @ 2022-10-11 14:44 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 972 bytes --] I wonder if you've got to make a class. MD: :::pc Sample text ::: CSS: .pc p {text-align:center;} Or some such. On Tuesday, October 11, 2022 at 10:39:03 AM UTC-4 richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > Hello! > > I'm trying to center some text in my markdown document. I've tried: > ``` > <p align="center"> Sample Text </p> > <center> Sample Text </p> > ``` > And used `pandoc test.md -o test.pdf` to compile my document. However, the > text shows up as left-aligned and not centered. > > How may I resolve this issue? > > Thank you. > -- 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/4a77f2aa-e010-4187-8ebd-f4959c5eae9fn%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 1661 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Unable to center text in Markdown [not found] ` <5466ba6b-31e3-4288-a86b-32463bdefe32n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-10-11 14:44 ` Craig Parker @ 2022-10-11 18:27 ` gnpan [not found] ` <2d6fdf96-2731-4970-a9eb-0f0d89e92c37n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 1 sibling, 1 reply; 5+ messages in thread From: gnpan @ 2022-10-11 18:27 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 963 bytes --] Since you are converting to pdf, you could try some LaTeX, e.g.: \begin{center}{Your text here}\end{center} On Tuesday, 11 October 2022 at 17:39:03 UTC+3 richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > Hello! > > I'm trying to center some text in my markdown document. I've tried: > ``` > <p align="center"> Sample Text </p> > <center> Sample Text </p> > ``` > And used `pandoc test.md -o test.pdf` to compile my document. However, the > text shows up as left-aligned and not centered. > > How may I resolve this issue? > > Thank you. > -- 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/2d6fdf96-2731-4970-a9eb-0f0d89e92c37n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 1642 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <2d6fdf96-2731-4970-a9eb-0f0d89e92c37n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Unable to center text in Markdown [not found] ` <2d6fdf96-2731-4970-a9eb-0f0d89e92c37n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-10-11 20:14 ` Richard Hu [not found] ` <CAPKRM+Uv6Sg_x6sYRvp0R9xhu77=Yn3wk+em5hun5xZ4WoWvOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Richard Hu @ 2022-10-11 20:14 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw [-- Attachment #1: Type: text/plain, Size: 2062 bytes --] Hi gnpan, Thanks! Your solution works, but I cannot put text formatted with Markdown between the \begin{center} ... \end{center} LaTeX tags. It seems like Pandoc understands the HTML (e.g. <h1> ... </h1>), but just refuses to acknowledge any alignment options specified. On Tue, Oct 11, 2022 at 7:27 PM gnpan <g.panayotou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Since you are converting to pdf, you could try some LaTeX, e.g.: > \begin{center}{Your text here}\end{center} > > > On Tuesday, 11 October 2022 at 17:39:03 UTC+3 richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > >> Hello! >> >> I'm trying to center some text in my markdown document. I've tried: >> ``` >> <p align="center"> Sample Text </p> >> <center> Sample Text </p> >> ``` >> And used `pandoc test.md -o test.pdf` to compile my document. However, >> the text shows up as left-aligned and not centered. >> >> How may I resolve this issue? >> >> Thank you. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "pandoc-discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/pandoc-discuss/xP71D6PnL2k/unsubscribe. > To unsubscribe from this group and all its topics, 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/2d6fdf96-2731-4970-a9eb-0f0d89e92c37n%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/2d6fdf96-2731-4970-a9eb-0f0d89e92c37n%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/CAPKRM%2BUv6Sg_x6sYRvp0R9xhu77%3DYn3wk%2Bem5hun5xZ4WoWvOQ%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 3457 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CAPKRM+Uv6Sg_x6sYRvp0R9xhu77=Yn3wk+em5hun5xZ4WoWvOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Unable to center text in Markdown [not found] ` <CAPKRM+Uv6Sg_x6sYRvp0R9xhu77=Yn3wk+em5hun5xZ4WoWvOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2022-10-12 10:23 ` BPJ 0 siblings, 0 replies; 5+ messages in thread From: BPJ @ 2022-10-12 10:23 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3267 bytes --] If you delimit the LaTeX commands you can put Markdown between them: `\begin{center}`{=latex}Markdown *here*`\end{center}`{=latex} or more realistically with raw blocks: ```{=latex} \begin{center} ``` Some *Markdown* text goes here! ```{=latex} \end{center} ``` Or you can use the attached filter (instructions inside!) and just type :::center Some *centered* text here ::: which will allow your source to work for both HTML and LaTeX output. Den tis 11 okt. 2022 22:15Richard Hu <richardyusen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: > Hi gnpan, > > Thanks! Your solution works, but I cannot put text formatted with Markdown > between the \begin{center} ... \end{center} LaTeX tags. > It seems like Pandoc understands the HTML (e.g. <h1> ... </h1>), but just > refuses to acknowledge any alignment options specified. > > > On Tue, Oct 11, 2022 at 7:27 PM gnpan <g.panayotou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Since you are converting to pdf, you could try some LaTeX, e.g.: >> \begin{center}{Your text here}\end{center} >> >> >> On Tuesday, 11 October 2022 at 17:39:03 UTC+3 richar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: >> >>> Hello! >>> >>> I'm trying to center some text in my markdown document. I've tried: >>> ``` >>> <p align="center"> Sample Text </p> >>> <center> Sample Text </p> >>> ``` >>> And used `pandoc test.md -o test.pdf` to compile my document. However, >>> the text shows up as left-aligned and not centered. >>> >>> How may I resolve this issue? >>> >>> Thank you. >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "pandoc-discuss" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/pandoc-discuss/xP71D6PnL2k/unsubscribe. >> To unsubscribe from this group and all its topics, 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/2d6fdf96-2731-4970-a9eb-0f0d89e92c37n%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/2d6fdf96-2731-4970-a9eb-0f0d89e92c37n%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/CAPKRM%2BUv6Sg_x6sYRvp0R9xhu77%3DYn3wk%2Bem5hun5xZ4WoWvOQ%40mail.gmail.com > <https://groups.google.com/d/msgid/pandoc-discuss/CAPKRM%2BUv6Sg_x6sYRvp0R9xhu77%3DYn3wk%2Bem5hun5xZ4WoWvOQ%40mail.gmail.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/CADAJKhC5qHx9gM9Djy10kVcSukADS6sCZsHXnQw-u2Aiwjx%2BQg%40mail.gmail.com. [-- Attachment #1.2: Type: text/html, Size: 5730 bytes --] [-- Attachment #2: center-latex.lua --] [-- Type: application/octet-stream, Size: 2118 bytes --] --[==============================[ # `center-latex.lua` A pandoc filter which turns Markdown like this :::center Some *Markdown* text goes here! ::: into LaTeX like this \begin{center} Some \emph{Markdown} text goes here! \end{center} by saying on the command line pandoc -L center-latex.lua my-doc.md -so my-doc.ltx or pandoc -L center-latex.lua my-doc.md -o my-doc.pdf ## Rationale This is useful e.g. if you want to generate both LaTeX/PDF and HTML from the same source, or just want to type less and have clean-looking source. # Installation Place the file `center-latex.lua` in the `filters` subdirectory/folder of your Pandoc user directory. To see where the user directory goes inspect the output of `pandoc --version`. This is typically $HOME/.local/share/pandoc/filters on Linux and MacOS and C:\Users\USERNAME\AppData\Roaming\pandoc\filters on Windows. You may need to create these directories first. On Linux/MacOS: mkdir -p ~/.local/share/pandoc/filters and on Windows typically md C:\Users\USERNAME\AppData\Roaming\pandoc\filters --]==============================] if 'latex' == FORMAT then -- Define once, use many times local begin_center = pandoc.RawBlock('latex', '\\begin{center}') local end_center = pandoc.RawBlock('latex', '\\end{center}') -- This is a "global"/non-local function function Div(div) -- Does the div have a class .center? if div.classes:includes('center') then -- We return just the content of the div local rv = div.content rv:insert(1, begin_center) -- prepend rv:insert(end_center) -- append return rv end -- else if no .center class do nothing return nil end else -- Minimal no-op function so the filter isn't "empty" function Pandoc() return nil end end --[==============================[ ## Copyright and license This software is Copyright (c) 2022 by Benct Philip Jonsson. This is free software, licensed under: The MIT (X11) License http://www.opensource.org/licenses/mit-license.php --]==============================] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-12 10:23 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-10-11 14:39 Unable to center text in Markdown Richard Hu [not found] ` <5466ba6b-31e3-4288-a86b-32463bdefe32n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-10-11 14:44 ` Craig Parker 2022-10-11 18:27 ` gnpan [not found] ` <2d6fdf96-2731-4970-a9eb-0f0d89e92c37n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-10-11 20:14 ` Richard Hu [not found] ` <CAPKRM+Uv6Sg_x6sYRvp0R9xhu77=Yn3wk+em5hun5xZ4WoWvOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2022-10-12 10:23 ` 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).