I'm using Pandoc to generate a PDF from markdown. When specifying header/footer information in the YAML metadata (as below), I continue to get a page number in the center of my footer (with the text of \fancyfoot[L] written overtop), in addition to the page number in footer on the right that I've specified with \fancyfoot[R].
How can I remove the default page number in the footer at center? If I use \pagenumbering{gobble} it just removes all page numbers, at center and on right.
---
title: Test Title
author: Author Name
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyhead[L]{Author Name}
- \fancyhead[R]{Test Title}
- \fancyfoot[L]{Extra text here}
- \fancyfoot[R]{\thepage}
---
Currently using Pandoc 1.17.2 on OSX 10.11.6.
Well, I think this should work if you just give the center field an empty content field. That is at least one way in which it works in Latex and hopefully the same for pandoc.
\fancyfoot[C]{}
Related
I am new to Quarto and I don't know yet how to apply global styles for PDF documents. Obviously I can't use CSS to render PDFs. So what is the equivalent for PDF?
How can I, for example, add a pagebreak automatically before each level 1 heading?
Thank you!
winnewoerp
Have a look at this section in the quarto documentation. You could for instance use the include-in-header functionality and this answer, e.g.
---
format:
pdf:
include-in-header:
text: |
\let\oldsection\section
\renewcommand\section{\clearpage\oldsection}
---
# First Section
## First Subsection
# Second section
I have a book made of several ordered Markdown files. I am using Pandoc to convert those into an epub file, and things are mostly okay. I can embed the font I like and provide my own CSS, etc. The problem is that the output file contains an element that is not present in the Markdown (as a "#" header element). This element is then being picked up by the ToC function and inserted into the Table of Contents. I didn't ask for the element to be present, and I can't find an option to turn it off.
Here's how to reproduce, with a much simpler case than my actual one, but it's sufficient to demonstrate the problem. I have the following file structure:
- pandoctest/
- src/
- file1.md
- file2.md
- epub.yml
The contents are as follows:
file1.md:
Here is some text.
file2.md:
# Chapter one
The chapter goes here.
epub.yml:
---
title:
- type: main
text: A Book
creator:
- role: author
text: Some Dude
---
And the pandoc command I'm running is:
pandoc -o output.epub epub.yml --toc src/*
The end result is something like this:
Page 1: An appropriate title page using the title and author elements from epub.yml
Page 2: The table of contents page. At the top, the title from epub.yml. Beneath that are two ToC entries. The first is the title of the book and refers to the element I don't want present on the next page. The second is "Chapter One" which refers to the # Chapter One element from my Markdown (this is appropriate).
Page 3: First, the undesired element, which, in the raw XML looks like this:
<h1 class="unnumbered" data-number="">A Book</h1>
Then, "Here is some text", a paragraph that I did indeed tell it to put there.
Page 4: A correctly rendered "Chapter One" page.
The question here is how to get pandoc to not render the "unnumbered" header element that is not present in the Markdown. It screws up the Table of Contents and I never asked for it to be there.
For reference, here is the epub that is rendered from my little test here: https://www.dropbox.com/s/dj4jo08g7q4f9i2/output.epub?dl=0
I put references in a yaml metadata-header:
references:
- id: fenner2012a
title: One-click science marketing
author:
- family: Fenner
given: Martin
...
(described here: http://johnmacfarlane.net/pandoc/README.html#extension-citations)
and I can cite this reference with See [#fenner2012a]....
This will create an output in the pdf like this: See ("One-click science marketing")... with no hyperlink on the reference.
Instead of the title I want to have auto-incremented number: See [1] with [1] being a hyperlink to the source. How can I achieve this?
Instead of the title I want to have auto-incremented number: See [1] with 1 being a hyperlink to the source. How can I achieve this?
Many CSL styles have a numeric format; you can try ACM Computing Surveys.
To specify the style, pandoc's documentation says:
These files are specified using the --csl option or the csl (or citation-style) metadata field.
There's one caveat when going to PDF, however. I haven't found a way to get the hyperlinking to work.
That is, you'll get See [1] but there is no hyperlink.
Edit: You can get this to work by using the following setting in meta-data:
link-citations: true
You can get hyperlinks in PDF by using LaTeX's way of formatting references. But I think you'll have to convert your reference to .bib format and specify it in your metadata:
bibliography: references.bib
pdf:
cite-method: biblatex
I have a Drupal 7 installation, multilingual. No matter which input format i'm choosing for the node body, every HTML tag is stripped. The input format is well configured. It's like Drupal always uses Plain Text as Filter, even if Full HTML is selected.
I found the answer in the Drupal Forum:
https://drupal.org/node/1829860
For the records: After some searching I found the culprit: I defined a
custom display setting for the content type article
(/admin/structure/types/manage/article/display) and changed (by
mistake) the field format to "plain text" for the body text. Reverting
to "default" fixed the problem.
I'm using wkhtmltopdf to generate pdf from html pages.
My question is how to set the position of table of content page? It seems that it automatically generated in the beginning of first page. In addition, how to set the css of content of content?
There's an--xsl-style-sheet (file) parameter to wkhtmltopdf, detailed thusly in the extended command line --help (or -H).
A table of content can be added to the document by adding a toc object to
the command line. For example:
wkhtmltopdf toc http://doc.trolltech.com/4.6/qstring.html qstring.pdf
The table of content is generated based on the H tags in the input
documents. First a XML document is generated, then it is converted to
HTML using XSLT.
The generated XML document can be viewed by dumping it to a file using
the --dump-outline switch. For example:
wkhtmltopdf --dump-outline toc.xml http://doc.trolltech.com/4.6/qstring.html qstring.pdf
The XSLT document can be specified using the --xsl-style-sheet switch.
For example:
wkhtmltopdf toc --xsl-style-sheet my.xsl http://doc.trolltech.com/4.6/qstring.html qstring.pdf
The --dump-default-toc-xsl switch can be used to dump the default
XSLT style sheet to stdout. This is a good start for writing your
own style sheet
wkhtmltopdf --dump-default-toc-xsl
The XML document is in the namespace
http://code.google.com/p/wkhtmltopdf/outline
it has a root node called "outline" which contains a number of
"item" nodes. An item can contain any number of item. These are the
outline subsections to the section the item represents. A item node
has the following attributes:
- "title" the name of the section
- "page" the page number the section occurs on
- "link" a URL that links to the section.
- "backLink" the name of the anchor the the section will link back to.
The remaining TOC options only affect the default style sheet
so they will not work when specifying a custom style sheet.
So you define your own XSLT, possibly based on their default, and pass it in. No problemo.
If you want you can even make your customized TOC using a html file. e.g.; if you want to create TOC on names of html file name(s) which will be used in PDF creation (please note that for this you should know names in advance) then you can do this by passing a HTML file say user_toc.html. In this files you can put all your captions/css etc and make a placeholder for file name. This files needs to be parsed with server side code which should fill the file name in placeholder. Now the modified file can be used for TOC.
Example code in Perl:
my $TOCPage = "user_toc.html";
my $file1 = "Testfile1.html";
my $file2 = "Testfile2.html";
my $toc_file_lines;
# Open the user TOC for parsing and write in a buffer
open(FILE, $TOCPage);
read(FILE, $toc_file_lines, -s $TOCPage);
close(FILE);
# Substitute the placeholder with actual file name
$toc_file_lines =~ s/$file_name_placeholder/$file1/;
# Open the same file again and write back the buffer
open(FILE, ">".$TOCPage);
print FILE $toc_file_lines;
close(FILE);
# Linux path for wkhtmltopdf installation
my $wkhtmltopdf_path = '/usr/bin/wkhtmltopdf-i386';
my $command = "$wkhtmltopdf_path --margin-top 20mm --margin-bottom 15mm
--margin-left 15mm --margin-right 15mm
$TOCPage $file1 $file2 $pdf_manual_name";
`$command 2>&1`;
More over you can add a lot other info in TOC like chapter no/total page in chapter so on.
Hope this helps.