In LaTeX one could for example have a nice inline equation like $x^2=4$, which in docx format I would be glad to have as italic text.
Is there a way to tell Pandoc to use one of these solutions depending on the output format?
When searching for a possible solution, I realized pandoc has filters and templates. I would not really understand, which direction to follow.
But I would really like to arrive with a more general solution, that would also work for analogous tasks like, for example, smaller spaces between a number and units: In LaTeX straightforward $\;$, but including this in my Markdown document would not give me a satisfactory result in DOCX or ODT output.
This is what I found from the pandoc manual
For docx output, styles will be defined in the output file as inheriting from normal
text, if the styles are not yet in your reference.docx. If they are already defined,
pandoc will not alter the definition.
and please read the --reference-doc=FILE part of the maunal
--reference-doc=FILE
Use the specified file as a style reference in producing a docx or ODT file.
...
how to use the reference-doc in pandoc???
create a empty docx file and rename it (eg. refer.docx)
define the styles you want to display
add "--reference-doc=(refer.docx path)" into your pandoc command line .
Related
I'm trying to convert certain pages of a docx to pdf using pandoc but I can't find any sources hinting at where should I start. After taking a look into the pandoc documentation I still couldn't figure it out, so I just assumed that pandoc doesn't support this.
This might just act as a confirmation for future readers, Does pandoc support page range converting?
Pandoc has no concept of pages.
Putting text on pages happens during rendering with Word and LaTeX, but pandoc does not render the text before converting. Therefore it cannot know on which page a specific letter will be placed.
I am using Typora Markdown text editor wherein highlighting text is done with ==[...]== operation. This is also the case for many other Markdown editors such as Obsidian, Quilt, iA Writer, etc.
What is a way for pandoc to convert the == highlighting when converting to a pdf file ?
Sample.md
==Testing==
Then performing
pandoc Sample.md -o test.pdf
produces a pdf with "==Testing=="
The short answer is: there isn't one, highlighting syntax is currently not supported by pandoc. For more details, refer to the related discussion on the pandoc mailing list.
The long answer is that you could write a Lua filter or even a custom Markdown parser to add support for various features, but that's non-trivial in this case.
Can pandoc be used to take a (pandoc) markdown file that is hard wrapped and reflow the text and use one line for paragraph, but otherwise don't change anything? Usecase would be to take hardwrapped text and transform it so an online textbox doesn't mess it up when pasting.
It depends a little in your definition of "doesn't change anything else", but --wrap=none is probably the option that you are after. Pandoc's Markdown output is opinionated, so it may not do exactly what you want.
I'm playing around with pandoc to see if it is able to convert all aspect of word doc to .md reliably. Looks like it handles lot of stuff pretty well such as table of contents, images, etc.. However, I am looking to see if it can also understand a diagram in word doc that has been made using combining multiple shapes of word. for, e.g. diagram like below in your word doc:
when I do "pandoc --extract-media=. my.docx -o my.md" to convert to .md, mark down doc does not have any thing related to word shapes. Looks like it does not understand it. Is there any way to make pandoc smart enough to undestand word shapes ?
No, pandoc cannot handle these. There are two issues for this on the pandoc issue tracker, #4735, and #2792.
My aim is to produce a document by mixing hand-written .tex files and .tex files generated from an Rmarkdown file using knitr with figures rendered as tikzpicture.
How do I achieve the generated .tex file to simply contain
\begin{figure}
\input{unnamed-chunk-1-1.tex}
\end{figure}
I am struggling with tikz as device. I tried the tikzDevice library as well as knitr::opts_chunk$set(dev="tikz") I managed to create a .tex file with a tikzpicture environment for every chunk. Unfortunately knitr rendered said .tex file to pdf and generated an \includegraphics command. The most annoying problem with that is, I need to copy-paste my header into options(tikzLatexPackages) redundantly or "TeX is unable to calculate metrics".
Additionally I did not manage to put the graphics into a figure environment. If I simply enclose the chunk with \begin{figure} and \end{figure}, it will not include the pdf at all anymore and replace the command with ![](figures/unnamed-chunk-1-1.pdf)<!-- -->.
After going through the Rmarkdown documentation, I tried setting the chunkoption external=TRUE, but that had no effect.
EDIT: The environment should be generated when setting the chunk option fig.env='figure', but like external=TRUE, that had no effect on the generated .tex file.