Markdown to PDF - Stupid huge margins for Letter-sized pages

Showing 1-13 of 13 messages
Markdown to PDF - Stupid huge margins for Letter-sized pages Manchuwook 3/14/12 10:41 AM
If I just do pandoc jade-readme.md -o jade-readme.pdf, I get an output document where 1/4th of it is empty white space around all edges and the text is squeezed in the middle.  --variable=vmargin:1cm --variable=hmargin:1cm doesn't do squat.  What am I missing here?
Re: Markdown to PDF - Stupid huge margins for Letter-sized pages Joost 3/14/12 11:41 AM

You'll need a LaTeX template that actually uses these variables. you could
add something like the following line to your template:

\usepackage[vmargin=$vmargin$,hmargin=$hmargin$]{geometry}

As a general note, I think it would be a good idea if something like this
would be added to the default template. The geometry package has quite a
number of options and I don't think it would make sense to support them
all, but a few basic ones could be useful. Personally, I have:

$if(geometry)$
\usepackage[$geometry$]{geometry}
$endif$

so I can call pandoc with --variable=geometry:a4paper to get pdf output for
A4 paper instead of Letter paper.

--
Joost Kremers
Life has its moments

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages fiddlosopher 3/14/12 2:11 PM
+++ Joost Kremers [Mar 14 12 19:41 ]:

Not a bad idea.  I'll consider this.

Note that instead of using a custom template, you can create a small
file margins.sty with the needed code:

\usepackage[vmargin=1in,hmargin=1in]{geometry}

and include this in the header using -H:

pandoc -H margins.sty -f latex -s -t whatever...


Re: Markdown to PDF - Stupid huge margins for Letter-sized pages fiddlosopher 3/14/12 2:17 PM
+++ Joost Kremers [Mar 14 12 19:41 ]:

I've added this to the default template.

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages fiddlosopher 3/14/12 2:42 PM
+++ John MacFarlane [Mar 14 12 14:17 ]:

I've also added variables for
romanfont
sansfont
monofont
which btw only work with xelatex and lualatex.  So you can do

pandoc README -o readme.pdf --latex-engine=xelatex -V romanfont='TeX Gyre Pagella'

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages BP Jonsson 3/14/12 3:16 PM
On 2012-03-14 22:17, John MacFarlane wrote:
>> $if(geometry)$
>> >  \usepackage[$geometry$]{geometry}
>> >  $endif$
>> >
>> >  so I can call pandoc with --variable=geometry:a4paper to get pdf output for
>> >  A4 paper instead of Letter paper.
> I've added this to the default template.

Since geometry has many options, why not the following?

     $if(geometry)$
     \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
     $endif$

As I mentioned before I set up my template like this to
set font features for the `\defaultfontfeatures`,
`\setmainfont`, `\setsansfont` and `\setmonofont`
commands from fontspec, among other things. Since in
most cases I have defaults which differ from (Xe)TeX's
it actually looks as follows (with whitespace added for
readability -- I don't have any linebreaks inside the
commands in the actual templates.)

     \setmainfont$if(main-feat)$[
         $for(main-feat)$$main-feat$$sep$,$endfor$
     ]$endif${$if(main-font)$$main-font$$else$Charis SIL$endif$}

Not that defaults like this would necessarily be a good
idea for *the* default template, though!

/bpj

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages BP Jonsson 3/14/12 3:43 PM
On 2012-03-14 22:42, John MacFarlane wrote:
> +++ John MacFarlane [Mar 14 12 14:17 ]:
ve added this to the default template.
>
> I've also added variables for
> romanfont
> sansfont
> monofont
> which btw only work with xelatex and lualatex.  So you can do
>
> pandoc README -o readme.pdf --latex-engine=xelatex -V romanfont='TeX Gyre Pagella'
>

\setromanfont is deprecated in favor of \setmainfont,[^1]
so it may be safest to use the latter. Of course the
pandoc variable an be called anything, but it might be
better if it conforms to preferred fontspec usage.

/bpj

[^1]: "\setromanfont This is the old name for \setmainfont,
retained for backwards compatibility." now hid away on
page 58 of the manual inside the code documentation.

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages fiddlosopher 3/15/12 10:49 AM
+++ BP Jonsson [Mar 14 12 23:16 ]:

> On 2012-03-14 22:17, John MacFarlane wrote:
> >>$if(geometry)$
> >>>  \usepackage[$geometry$]{geometry}
> >>>  $endif$
> >>>
> >>>  so I can call pandoc with --variable=geometry:a4paper to get pdf output for
> >>>  A4 paper instead of Letter paper.
> >I've added this to the default template.
>
> Since geometry has many options, why not the following?
>
>     $if(geometry)$
>     \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
>     $endif$

Good, I've adopted this suggestion.  I've also changed
'romanfont' to 'mainfont'.

John

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages Aditya Mahajan 3/15/12 12:10 PM

If you are adding these, can you also add \setmathfont?

Aditya

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages fiddlosopher 3/15/12 2:39 PM
+++ Aditya Mahajan [Mar 15 12 15:10 ]:

Okay, done.

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages Manchuwook 3/16/12 8:43 AM
Which template, PDF or Markdown?
Re: Markdown to PDF - Stupid huge margins for Letter-sized pages Seablade 3/16/12 9:20 AM
Latex.  There is no PDF template.  Pandoc uses LaTex to generate PDFs, thus why you would ened to create a LaTex template, or file to be included in the header of the LaTex document.

    Thomas Vecchione

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/oJrzx8j6aGIJ.

To post to this group, send email to pandoc-...@googlegroups.com.
To unsubscribe from this group, send email to pandoc-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.

Re: Markdown to PDF - Stupid huge margins for Letter-sized pages BP Jonsson 3/17/12 11:11 AM

I've thought about this some more. Since not all
geometry's options can be set as package options it's
in fact better to set them with the `\geometry` command
like this:

     $if(geometry)$
     \usepackage{geometry}
     \geometry{$for(geometry)$$geometry$$sep$,$endfor$}
     $endif$

In my template I've also added the following to make
sure memoir plays nice with geometry. I'm not 100% sure
it's needed, but I keep it as I also can set those
variables at need:

~~~~ {.latex .pandoc_template}
\makeatletter
\@ifclassloaded{memoir}{
 
\setstocksize{$if(stock-h)$$stock-h$$else$\paperheight$endif$}{$if(stock-w)$$stock-w$$else$\paperwidth$endif$}

 
\settrimmedsize{$if(paper-h)$$paper-h$$else$\paperheight$endif$}{$if(paper-w)$$paper-w$$else$\paperwidth$endif$}{*}
 
\settrims{$if(trim-top)$$trim-top$$else$0pt$endif$}{$if(trim-edge)$$trim-edge$$else$0pt$endif$}
}{}
\makeatother
~~~~

In the normal case with for-distribution rather than for-printshop
PDFs it boils down to:

~~~~ {.latex}
\makeatletter
\@ifclassloaded{memoir}{
     \setstocksize{\paperheight}{\paperwidth}
     \settrimmedsize{\paperheight}{\paperwidth}{*}
     \settrims{0pt}{0pt}
}{}
\makeatother
~~~~

/bpj