ismayc / thesisdown

An updated R Markdown thesis template using the bookdown package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't control figure size in pdf

matanmazor opened this issue · comments

commented

When knitting to thesis_pdf, my figures (external png files) are waaaay too large, and setting out.width='100%' or fiddling with the out.extra option doesn't seem to affect figure size.

e.g. (replace apostrophes with backticks),

'''{r ch3-exp1-design, echo=FALSE, out.width='100%'}
include_graphics(path = "figure/ch3/design.png")
'''

'design.png' is this file here: https://github.com/matanmazor/detectionVsDiscrimination_fMRI/blob/master/docs/experimentDesign.png
but it happens with all my figures.

Thanks!!!

Does out.width="20%" or something smaller produce the same result?

commented

Yes :(
It also ignores fig.scap="Short caption" for creating the figure list, so I wonder if this is something more general.

I'm getting this to work with out.width="0.2\\linewidth". Can you confirm?

fig.scap only shows up in the List of Figures text for that image: https://yihui.org/knitr/options/

commented

Still not working \:
And fig.scap does not affect the List of Figures too...

I'm unable to reproduce as it is working on the computers I have tried. Can you share a Loom video of what you are seeing? It would also be helpful to share what your sessionInfo() looks like.

commented

I restarted RStudio and now it works! But if I make changes to the size / fig.scape of other figures I need to restart RStudio again for the change to take effect (clear cache doesn't do the trick).

Session info:

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 pillar_1.4.4 compiler_3.6.0 remotes_2.2.0 tools_3.6.0 digest_0.6.27 evaluate_0.14 lifecycle_0.2.0 tibble_3.0.1 nlme_3.1-139
[11] lattice_0.20-38 pkgconfig_2.0.3 png_0.1-7 rlang_0.4.10 DBI_1.1.0 rstudioapi_0.11 yaml_2.2.1 xfun_0.21 dplyr_1.0.4 knitr_1.28
[21] generics_0.0.2 vctrs_0.3.6 rprojroot_1.3-2 grid_3.6.0 tidyselect_1.1.0 glue_1.4.1 here_0.1 R6_2.4.1 thesisdown_0.1.0 rmarkdown_2.6
[31] bookdown_0.21 purrr_0.3.4 tidyr_1.1.0 blob_1.2.1 magrittr_1.5 backports_1.1.7 ellipsis_0.3.1 htmltools_0.5.1.1 assertthat_0.2.1 broom_0.5.6
[41] crayon_1.3.4

Thanks Chester!

Unfortunately I still can’t reproduce in your environment. I’d suspect it is something beyond thesisdown that is causing issues. I’m going to close this issue but if you find it is a thesisdown issue please reopen.

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org whenever possible) and link to this issue. If a reprex is not applicable, recording a short Loom video showing what you are seeing can go a long way in helping to diagnose problems.