[R] Can someone please have a look at this query on stackoverflow?

Olivier Crouzet o||v|er@crouzet @end|ng |rom un|v-n@nte@@|r
Sat Nov 18 08:21:25 CET 2023


Dear Ashim,

these are documented in the LaTeX 'geometry' package (see for example
on CTAN: https://ctan.org/pkg/geometry). As I added in my response on
Stackoverflow, several parts in the RMarkdown header actually concern
information that are processed by LaTeX to actually generate the PDF,
among which the 'geometry' line. For someone who is used to working with
LaTeX, it is relatively natural to 'identify' LaTeX options in these
lines even though they are not structured exactly this way in a LaTeX
document (but their names are the same).

Concerning the choice for these specific numbers, it is relatively
arbitrary. I've been doing this on LaTeX for years when I want to
generate slides without using the 'beamer' document class and the
things to take into account are:

- These dimensions express the physical sizes of the pdf page (in a
sense, what their size would be if you print the document without
adapting to the paper in your printer)
- If these sizes are reduced... the relative font size will increase
because LaTeX will project the same font on a smaller virtual paper,
- And if these sizes are increased... the relative font size will
decrease because LaTeX will project the same font on a larger
virtual paper, 
- I processed starting from 16x9cm sizes, resp. for paperwidth and
paperheight, and estimated that the fonts were too large to my taste,
then doubled them and felt that the fonts were too small for slides,
then I ended up trying multiplying 16x9cm by a factor of 1.5, which
gave me 24x13.5cm and I found it was ok.
- But one may vary these sizes arbitrary (even using smaller
steps and ratios differing from 16/9) depending on the aims to be
reached.
- It is also possible to specify different units (pt = points, in =
inches...)

Yours.
Olivier.

On Sat, 18 Nov 2023 09:53:19 +0530 Ashim Kapoor <ashimkapoor using gmail.com>
wrote:

> Dear Olivier,
> 
> Many thanks for your reply.
> 
> This works well for me.
> 
> How did you come up with the pagewidth / pageheight numbers?  I do
> understand that their ratio = 16:9,
> but how did you choose these numbers?
> 
> Best Regards,
> Ashim
> 
> On Fri, Nov 17, 2023 at 9:25 PM Olivier Crouzet
> <olivier.crouzet using univ-nantes.fr> wrote:
> >
> > Dear Ashim,
> >
> > I don't think the aspectratio is appropriate in this context because
> > it would imply that the beamer (LaTeX) class is used but you're
> > actually using the article (LaTeX) class.
> >
> > You may use specifications of the geometry package rather than
> > specifying options to the class:
> >
> > e.g. replace your current header:
> >
> > ---
> > title: "Testing landscape and aspect ratio"
> > output:
> >   pdf_document:
> >     number_sections: true
> > classoption:
> >   - landscape
> >   - "aspectratio=169"
> > header-includes:
> >    - \usepackage{dcolumn}
> > documentclass: article
> > geometry: margin=1.5cm
> > ---
> >
> > with this one:
> >
> > ---
> > title: "Testing landscape and aspect ratio"
> > output:
> >   pdf_document:
> >     number_sections: true
> > header-includes:
> >    - \usepackage{dcolumn}
> > documentclass: article
> > geometry: margin=1.5cm, paperwidth=24cm, paperheight=13.5cm
> > ---
> >
> > Of course, you may change the exact dimensions and it will impact
> > the relative font sizes. I've tested it and it generates what you
> > want.
> >
> > Yours.
> > Olivier.
> >
> >
> >
> >
> >
> >  On Tue, 14 Nov 2023 10:03:23
> > +0530 Ashim Kapoor <ashimkapoor using gmail.com> wrote:
> >
> > > Dear all,
> > >
> > > I have posted a query which has received a response but that is
> > > not working on my computer.
> > >
> > > Here is the query:
> > >
> > > https://stackoverflow.com/questions/77387434/pdf-from-rmarkdown-landscape-and-aspectratio-169
> > >
> > > Can someone please help me ?
> > >
> > > Best Regards,
> > > Ashim
> > >
> > > ______________________________________________
> > > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > > http://www.R-project.org/posting-guide.html and provide commented,
> > > minimal, self-contained, reproducible code.
> >
> >
> > --
> >   Olivier Crouzet, PhD
> >   http://olivier.ghostinthemachine.space
> >   /Maître de Conférences/
> >   @LLING - Laboratoire de Linguistique de Nantes
> >     UMR6310 CNRS / Université de Nantes
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html and provide commented,
> > minimal, self-contained, reproducible code.


-- 
  Olivier Crouzet, PhD
  http://olivier.ghostinthemachine.space
  /Maître de Conférences/
  @LLING - Laboratoire de Linguistique de Nantes
    UMR6310 CNRS / Université de Nantes



More information about the R-help mailing list