From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28729 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: James Madgwick Newsgroups: gmane.text.pandoc Subject: Raw content not working in header-includes for ODT Date: Wed, 30 Jun 2021 11:38:57 -0700 (PDT) Message-ID: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1010_1635725577.1625078337698" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33970"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDJIZ4FBYQKBBQXU6KDAMGQEASOX3YQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jun 30 20:39:02 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f184.google.com ([209.85.167.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lyf6y-0008Zh-R8 for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 30 Jun 2021 20:39:00 +0200 Original-Received: by mail-oi1-f184.google.com with SMTP id f84-20020aca38570000b02901f424a672b7sf1478793oia.18 for ; Wed, 30 Jun 2021 11:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=TRqB5rDO6SMJhXw6RBth4MOe4iImXeO57MdDgnwcD0g=; b=Bg2jVgVettm5qbbyBCR6YvlXyj31c5Ux50kCpUfa03JMY5P0Q0JB0CowwwNLM/qaPD 2DWxJ0dmpby6GWlSTB53gnWWhbhBI+PUmKe1NDGNQNUozu5eNwdNg7K2pKbZAL0L+x07 fZ0JbCGfFCkQxymngohb8XAgSFvvz+CeS3JFnMkIeWa2EUs8dRNvs1aWBDtC1SiQOHFb T2JCq4rtdVJc46IUP9buHRmVoGl2SaJp2XIJd4QGXAkjK08N81yEBW0AdLfNJC5Dfe01 Kkcs49nfCeBqSp+bwAUtcZW41fkEA//TFlXY7A54U8NCgLsOGD3HrktNq8YMKHh3I228 E9tA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=TRqB5rDO6SMJhXw6RBth4MOe4iImXeO57MdDgnwcD0g=; b=srBSCmi67iLOYtKoUBt6iGn2tl93H0/LoY/YwlvaGhIPXrarUocJI6Kv9Kw+KM2Zib kifZ8ESdH2VjO29cGnBg85E10CLhq8gczBdCLQgT4t2+2iOkC5A0owylUEX+/xtroNoo dmiUCDkhqyiYgIXFJApD/LCkhnaYDR5nohIs+o+EE4L5vdvp4JK2fbPsxmBsBLIF4ZZi fmymqR6lq0SqJgGiOfWtaHLeNrv/gsrIIg9vKmcSqnPGSmAU3O+f9elg6tOFDEjJ7X1U g2p2EQz6FlwkUAMWaQm2cW0Qp8Ef/CmZ0gxAKcjGHuiSxiihHU0eu2s0ffqgfc/FJkqI u1dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=TRqB5rDO6SMJhXw6RBth4MOe4iImXeO57MdDgnwcD0g=; b=HcB2hHlza2UIrza2MR5d6522OU/TO0/M9OS+rG6dMkO1PJq094Bb0Am6qMhxc74Xjz OuIYzdxtM0kz8/RBByCGmdSqRVrVPO2fVHcJaKMmeVGj33maUPIKRJ/Q4dDilXT8XGfV hmdYXjLmUNXxSKcsrKSA5xSu4fMRcfoIxU0up8RLjZitj7xKzEHKtYx45VscndrwhAyf cooa47/pMBS4HpW2MucIJ/AbxJ6S3fUfW8vgO7VhiiGr70wkjhCGybxoWivp2CZCwsrB hDXrQir0K3BvfJqHzMy1XmHC2v2hKiwnp4begvIP1f59rMmwsyycK1+8sMFzRYD++sjB om9g== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533g3aAxFEjYSYqp7fVWxxWj00wMCkShxi0VqQFnyLoeq4rZNNIm 5QVD1L4PdmJkwsVdrqtcJhA= X-Google-Smtp-Source: ABdhPJzeJ//T3lJvUEgWKymH0Ww2Bvr834LkdWKD+zk/IrOD6oWE+ywK0AHtDGToAeSb8HEUffc2ZQ== X-Received: by 2002:a05:6830:cf:: with SMTP id x15mr8919758oto.289.1625078339866; Wed, 30 Jun 2021 11:38:59 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:6d1a:: with SMTP id o26ls1149459otp.2.gmail; Wed, 30 Jun 2021 11:38:58 -0700 (PDT) X-Received: by 2002:a9d:609e:: with SMTP id m30mr10353753otj.168.1625078338311; Wed, 30 Jun 2021 11:38:58 -0700 (PDT) X-Original-Sender: madgemade-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:28729 Archived-At: ------=_Part_1010_1635725577.1625078337698 Content-Type: multipart/alternative; boundary="----=_Part_1011_36948546.1625078337698" ------=_Part_1011_36948546.1625078337698 Content-Type: text/plain; charset="UTF-8" This seemed to be a bug, but after a taking a closer look it seems to something which is not supported, although I'm not sure why that is. So I thought I'd post here to explain. When the source file is ODT, raw content (LaTex commands) in "header-includes" inside a YAML I'm passing in with '--metadata-file' is interpreted as plain text, causing invalid LaTex to be generated and placed in the header. This is ultimately because "The extension raw_attribute is not supported for odt". This is the YAML: title: Example Title header-includes: - | ```{=latex} \usepackage{tocloft} \setlength{\cftsubsecnumwidth}{2.8em} \setlength{\cftsubsubsecnumwidth}{3.6em} ``` When trying to create a PDF with "pandoc Untitled.odt --metadata-file test.yml -o test.pdf " an error is given by pdftex. This is because the Tex added to the header is not what I was expecting (based on previously using Pandoc with markdown as input). This is the invalid (for pre-document) LaTex added to the header: \texttt{\{=latex\}\ \textbackslash{}usepackage\{tocloft\}\ \textbackslash{}setlength\{\textbackslash{}cftsubsecnumwidth\}\{2.8em\}\ \textbackslash{}setlength\{\textbackslash{}cftsubsubsecnumwidth\}\{3.6em\}} The Manual says to use the raw_attribute extension to prevent the 'header-includes' being interpreted as markdown. This is enabled by default for markdown input, so I thought maybe it is just not enabled for ODT. Trying "pandoc Untitled.odt --from odt+raw_attribute --metadata-file test.yml -o test.pdf" gives me the error "The extension raw_attribute is not supported for odt". At this point I knew I hadn't found a bug. The Manual doesn't say about which formats are supported as input files when trying to add raw content with 'header-includes' and in effect when using 'raw-attribute'. It might be useful if this was added to prevent anyone else trying to use 'header-includes' when the source file is an ODT document. I was able to get the result I was originally looking for by placing the LaTex commands in a separate file and using the '--include-in-header' option. However, I'm not sure why ODT wouldn't support raw_attribute for just the YAML metadata. I suppose because it's not supported for the input document (ODT) itself and so isn't available when parsing the YAML either. I admit this is an unusual case, as normally '--metadata-file' wouldn't be used with ODT input. Thanks, James -- 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/b76a0256-4a21-468f-a04e-d7e7b6676d56n%40googlegroups.com. ------=_Part_1011_36948546.1625078337698 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This seemed to be a bug, but after a taking a closer look it seems= to something which is not supported, although I'm not sure why that is. So= I thought I'd post here to explain.

When the sour= ce file is ODT, raw content (LaTex commands) in "header-includes" inside a = YAML I'm passing in with '--metadata-file' is interpreted as plain text, ca= using invalid LaTex to be generated and placed in the header. This is ultim= ately because "The extension raw_attribute is not supported for odt".

This is the YAML:

title: Example Title
header-includes:
- |
  ```{=3Dlatex}<= br>  \usepackage{tocloft}
  \setlength{\cftsubsecnumwidth}{2.8= em}
  \setlength{\cftsubsubsecnumwidth}{3.6em}
  ```
<= div>
When trying to create a PDF with "pandoc Untitled.odt --= metadata-file test.yml -o test.pdf
" an error is given by pdftex. This i= s because the Tex added to the header is not what I was expecting (based on= previously using Pandoc with markdown as input).

= This is the invalid (for pre-document) LaTex added to the header:

\texttt{\{=3Dlatex\}\ \textbackslash{}usepackage\{tocloft\}= \ \textbackslash{}setlength\{\textbackslash{}cftsubsecnumwidth\}\{2.8em\}\ = \textbackslash{}setlength\{\textbackslash{}cftsubsubsecnumwidth\}\{3.6em\}}=

The Manual says to use the raw_attribute exte= nsion to prevent the 'header-includes' being interpreted as markdown. This = is enabled by default for markdown input, so I thought maybe it is just not= enabled for ODT. Trying "pandoc Untitled.odt --from odt+raw_attribute --me= tadata-file test.yml -o test.pdf" gives me the error "The extension raw_att= ribute is not supported for odt". At this point I knew I hadn't found a bug= .

The Manual doesn't say about which formats are s= upported as input files when trying to add raw content with 'header-include= s' and in effect when using 'raw-attribute'. It might be useful if this was= added to prevent anyone else trying to use 'header-includes' when the sour= ce file is an ODT document.

I was able to get the = result I was originally looking for by placing the LaTex commands in a sepa= rate file and using the '--include-in-header' option. However, I'm not sure why ODT wouldn't support raw_attrib= ute for just the YAML metadata. I suppose because it's not supported for th= e input document (ODT) itself and so isn't available when parsing the YAML = either. I admit this is an unusual case, as normally '--metadata-file' woul= dn't be used with ODT input.

Thanks,
Jam= es

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/b76a0256-4a21-468f-a04e-d7e7b6676d56n%40googlegroups.= com.
------=_Part_1011_36948546.1625078337698-- ------=_Part_1010_1635725577.1625078337698--