# Tag Info

## Hot answers tagged pandoc

99

With pandoc 1.12.x and it’s new YAML metadata capabilities you could add all the information and all LaTeX-code you need in your markdown document like this: --- title: Test author: Author Name header-includes: | \usepackage{fancyhdr} \pagestyle{fancy} \fancyhead[CO,CE]{This is fancy} \fancyfoot[CO,CE]{So is this} \fancyfoot[LE,RO]{\...

94

I tried nearly all methods mentioned in other answers. Eventually, and surprisingly, I found the most satisfactory way to convert is to just open the PDF file in MS Word (2013 or newer), which retained most of the layout. Although you are gonna lose the hyperlinks of cross-references.

68

The writer.latex file in Pandoc's source code currently defines \tightlist as: \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} This is also currently the case in the default LaTeX template, from the jgm/pandoc-templates project on Github. For posterity, here is a link to the most up-to-date LaTeX default template: ...

38

(See Update at the end, to get proper colors) By default pandoc uses its own highlighting engine, but it can be changed to use package listings instead. Simply add --listings option to your pandoc command line. However, the format used by listings does not break long lines either, but you can prepare all the required options in a separate tex file, for ...

37

YAML header --- mainfont: Font-Regular.otf mainfontoptions: - BoldFont=Font-Bold.otf - ItalicFont=Font-Italic.otf - BoldItalicFont=Font-BoldItalic.otf --- command line $pandoc in.md --pdf-engine=xelatex \ -V 'mainfont:Font-Regular.otf' \ -V 'mainfontoptions:BoldFont=Font-Bold.otf, ItalicFont=Font-Italic.otf, BoldItalicFont=Font-... 34 I gave up on pandoc for almost exactly the same reasons you listed. If you are set on using pandoc, the simplest solution may be to just identify environments and packages that cause trouble - and then not use them, or just type the offending stuff directly in to MS Word. I've had a fair amount of luck with going to word documents using latex2rtf to create ... 29 It has always been a possibility although obviously the document markup side of latex is mostly aimed at hand authored documents, but even back while 2e was being developed there were wysiwyg systems like sw that are essentially generating latex that isn't touched and latex is often used for typesetting from XML (or previously SGML) using xslt or dsssl or ... 26 You can pass the lang option to the template using -V which passes it further to the babel package. pandoc -V lang=nl somefile.markdown This is translated to the following LaTeX code which should result in dutch chapter headings. \usepackage[dutch]{babel} 25 I hit the same problem. It seems that pandoc started using \tightlist in \begin{itemize} sections. My workaround was simply to add an empty macro for \tightlist to my template file (I run pandoc with --template=mytemplate.tex): \def\tightlist{} 23 Pandoc cannot use a template provided as a *.csl file to style its DOCX output. If you want to get Pandoc using a specific set of styles, you need to create (or grab) another DOCX file containing these styles. Note, that the style names do need to conform to the standard names in the first place. (In the past I've succeeded to let it use non-standard style ... 21 LaTeX2rtf is the easiest and fastest way to convert .tex files to .rtf that can be read by Microsoft Word. Using it is as simple as downloading the program, choosing your .tex file, and pressing run. A command window will open up to display the progress and warn of any errors. In most cases the default settings will be sufficient and despite errors it can ... 20 An extension exists on github: pandoc-crossref install it with cabal update cabal install pandoc-crossref or in archlinux using ArchHaskell pacman -Sy pandoc-crossref you can use it by doing $$math$$ {#eq:label} [@eq:label] and compiling with pandoc file.md --filter pandoc-crossref -o file.pdf for more information see the documentation ... 19 As of pandoc-citeproc-0.4 pandoc-citeproc has support for a \nocite{*}-equivalent. mybib.bib file: @article{behbahani2014aircraft, title={Aircraft Integration Challenges and Opportunities for Distributed Intelligent Control, Power, Thermal Management, Diagnostic and Prognostic Systems}, author={Behbahani, Alireza R and Von Moll, Alexander and ... 19 The --biblatex option only applies when the output document is LaTeX format. When I tried pandoc --bibliography=foo.bib -o foo.docx foo.tex it worked for me. If you want Chicago you need to add an option for that e.g. --csl=chicago-author-date.csl. You can get the CSL file from github.com/citation-style-language/styles. 19 The solution is to use a CSL file to format the citations. I used ieee.csl from https://github.com/citation-style-language/styles pandoc -s foo.tex --bibliography=foo.bib --csl=ieee.csl -o foo.docx 19 Still off-topic but you can print the default template with pandoc -D latex, edit it and put it in your personal data directory ($HOME/.pandoc on linux): pandoc -D latex > ~/.pandoc/default.latex && $EDITOR ~/.pandoc/default.latex All of this is documented here: https://pandoc.org/MANUAL.html 18 This is most likely because the figure environment floats, which is not what you're after. For this you have a couple of options: Add the float package which provides the H float specifier, allowing you to use \usepackage{float}% http://ctan.org/pkg/float %... \begin{figure}[H] %... \caption[<ToC>]{<regular>} \end{figure} stopping the float ... 18 pandoc cannot convert a .bib file into another file format1. However, it can convert a .tex file which contains references (called from a .bib file) into a pdf, odt, html, ... If your .tex file just contains the \nocite{*} command, the result is similar (you will have all your references printed). Here is the magic command: pandoc test.tex -o output.odt --... 18 Use a gathered environment inside the equation environment: \documentclass{article} \usepackage{amsmath} % for "gathered" env. \begin{document} $$\label{eq1} \begin{gathered} x_1 = 1, x_2 = 1 \\ h(x) = f(-20 + 15 + 17) \\ h(x) = f(12) \approx 1 % no "\\" needed here \end{gathered}$$ \end{document} 17 A simple solution is to add a line with a backslash and space immediately after the figure, followed by a blank line: ![Alt text](image.png) \ Some text after the figure... Do not forget the space after the backslash! This seems to work on Pandoc 1.12.4.2. Edit: as pointed out in the comments, this will suppress figure captions. 16 If you want to use citations, you also have to define the CSL-style (Citation Style Language) to be used, via a *.csl-file you have to reference. Here is an MWE in Markdown. It tests a few different methods to provide references to citations in Markdown: # Markdown source code for relevant part of this page ` {.markdown} i. [@nonexistent] i. @... 14 Nevermind, I found a way to do it. I was using the builtin code highlighter. Setting the --listings flag, I can switch to the lstlistings package and use the following syntax: ~~~~{caption="The preprocessing step" label=lstpreprocess} def myfunction(var): """ Oh how awesome this is. """ pass ~~~~ Pandoc is awesome. 13 In pandoc you can do: (@foo)$a^2 + b^2 = c^2$As (@foo) says, ... (@bar)$e = x + y$This will give you running equation numbers in both PDF and HTML. However, the equations will not be centered or display-formatted. (You can use$$for display math, but then the numbers probably won't be lined up right -- though maybe this can be fixed with CSS.) 13 I'm not sure you want to read this. If you are forced to use MS Word for your work then better use Word to write it. LaTeX typesetting is much better than Word can do. So every conversion from LaTeX to Word will disappoint you about the quality of the conversion---if possible. Why do you want to do the same "work" two times: first writing your script in ... 13 Pandoc's LaTeX importer may not handle every input very well, but when you go via Pandoc's markdown format, which maps basically one-to-one to Pandoc's internal document representation, you have precise control over the output. Convert .tex to markdown: pandoc document.tex -o document.md Manually clean up the generated markdown file. Pandoc's extended ... 13 You can change the default.latex template in order to allow horizontal and vertical scaling. Get the template: pandoc -D latex > mytemplate.latex Find the section$if(graphics)$. . .$endif\$ and replace its content with: \usepackage{graphicx} % Redefine \includegraphics so that, unless explicit options are % given, the image width will not exceed ...

13

Pandoc has you covered! It is set up to produce document "fragments" by default, but there's the -s or --standalone flag, which will give you a whole .tex file. So something like pandoc -s -t beamer SLIDES -o example8.tex should do the trick.

13

Pandoc includes raw HTML only if the output format is HTML-like. From the web-site: The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous, DZSlides, EPUB, Markdown, and Textile output, and suppressed in other formats. In order to get images to work for both, HTML and PDF writer, you have to use pandoc's own format: ![la lune](lalune.jpg ...

13

If you do pandoc -D latex the template is printed. This works for any format. You could save that template as e.g. 'template.latex' and edit it. You can then point Pandoc to the edited template by doing e.g. pandoc --template=template.latex. Or you could call it 'default.latex' and place it in Pandoc's data directory. This will make it the default template.

12

I will show a solution with tex4ht. I used your sample text and added some math samples from the internet. You can see the complete resulting webpage on my Github page. All code is also hosted on Github. You have four wishes, some of them can be solved using external Javascript tools, for others we must create custom JS scripts. tex4ht can be configured ...

Only top voted, non community-wiki answers of a minimum length are eligible