Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust page margins, column wrap for pdf outputs #699

Closed
wants to merge 23 commits into from

Conversation

Robert-Krajcik
Copy link
Contributor

@Robert-Krajcik Robert-Krajcik commented Nov 14, 2023

Closes #651

@Robert-Krajcik Robert-Krajcik self-assigned this Nov 14, 2023
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d1a4596) 77.17% compared to head (fbb916e) 77.17%.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #699   +/-   ##
=======================================
  Coverage   77.17%   77.17%           
=======================================
  Files          33       33           
  Lines        4872     4872           
=======================================
  Hits         3760     3760           
  Misses       1112     1112           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Robert-Krajcik
Copy link
Contributor Author

Robert-Krajcik commented Nov 27, 2023

I am convinced that R Markdown and tinytex were never designed to work together.
I managed to get this small .Rmd script to (eventually) run on my Cytel laptop,
TexLive was working and was able to install all the dozen or so missing *.sty files.

Here, the system would just hang, but at least I could see the message in the *.log file

The solution for me was to install the full tinytex. No possibility of any missing *.sty files here.

TinyTeX-2 contains the scheme-full scheme of TeX Live, which means all LaTeX packages that you could possibly install from CTAN. This is the largest bundle, and only available in the daily release.

tinytex::uninstall_tinytex()
tinytex::install_tinytex(bundle = 'TinyTeX-2', repository = "https://ctan.math.illinois.edu/")

Of course, the tinytex distribution is installed in your Appdata/Roaming directory, and is not seen by {renv}

---
title: "IrisData"
output:
  pdf_document:
    latex_engine: xelatex
---
options(tinytex.verbose = TRUE)
knitr::opts_chunk$set(echo = TRUE)
library(knitr)
library(kableExtra)
knitr::kable(iris[1:3, 1:4], format = 'latex',
      caption="Some iris data") 

@Robert-Krajcik
Copy link
Contributor Author

One way we can "standardize" the installation of tinytex is to have everyone just download
https://yihui.org/tinytex/TinyTeX.zip
(this is the moderately large zip file 225+ Mb that has everything we need)
and then unzip to your AppData\Roaming folder in windows.
(I have found that using tinytex::install_tinytex(bundle = 'TinyTeX') doesn't always work -- missing tlmgr)
The command: tinytex::is_tinytex() should return TRUE after that.

@Jeff-Thompson12
Copy link
Collaborator

I think our big problem is deployment though.

@Robert-Krajcik
Copy link
Contributor Author

Robert-Krajcik commented Nov 30, 2023

Or just use format = 'pipe' (pandoc) and not worry about tinytex distributions.
The issue I have with the tinytex distribution installed in your appdata/roaming folder is that it is not recorded anywhere in {renv}

@Robert-Krajcik Robert-Krajcik marked this pull request as ready for review November 30, 2023 21:15
@Robert-Krajcik
Copy link
Contributor Author

Robert-Krajcik commented Nov 30, 2023

FYI, when I use format = 'latex' for the maint metrics chunk, I see
Underfull \hbox (badness 10000) in paragraph at lines 179--180
in the log. The first page of the pdf output was written, but it just stops here.

I figured this out. Not an issue anymore.

@Robert-Krajcik
Copy link
Contributor Author

Maintenance metrics page for {survival} package:
image
Community usage page for {survival} package:
image

Both using format = 'latex'

@Robert-Krajcik
Copy link
Contributor Author

Hi @AARON-CLARK
Everything is working now Ready for your review.

@Jeff-Thompson12
Copy link
Collaborator

@Robert-Krajcik I got this working on my machine as well and can see the wrapping. However, in order to accomplish this I had to follow your instructions on "standardizing" the installation of TinyTex (previously kableExtra code would not work for me). I guess my main concern is how do we set up deployment environments. Is this something that we can do on Posit Connect? If not, all this work will have to be discarded when we do #702 which is high priority.

@Jeff-Thompson12
Copy link
Collaborator

So another approach to this problem could be to use a package such as {pagedown} to print the HTML outputs. We would need to spend some time making those outputs print friendly, but this has the added benefit of maintaining the look and feel of our application.

@Robert-Krajcik
Copy link
Contributor Author

Robert-Krajcik commented Dec 5, 2023

image

Currently in the windows environment, installing the tinytex distributions don't work.
(but they do work on Posit workbench!)
Current workaround is to unzip the TinyTeX.zip (225+ MB) file found on https://github.com/rstudio/tinytex-releases
to your Appdata/Roaming folder

@AARON-CLARK
Copy link
Collaborator

Hi @Robert-Krajcik, good to hear that it works in a unix / linux env. Technically, windows is not as important, even though it's our common dev env among contributors. Regarding linux install, which command did you use to gain success? I see you reference three different commands in this PR, so I'm just curious which one I should play with myself?

First

tinytex::uninstall_tinytex()
tinytex::install_tinytex(bundle = 'TinyTeX-2', repository = "https://ctan.math.illinois.edu/")

Second

tinytex::install_tinytex(bundle = 'TinyTeX')

Third

tinytex::install_prebuilt()

One thing I think this PR needs may be a small blurb added to our "Deployments" article describing how users may need this system dependency, if they don't already have it.

Last, I think before merging this PR, we should test it on our Posit Connect instance. It looks like @Jeff-Thompson12 may have cracked the code for system installation, but we can work with Biogen IT to verify.

@Robert-Krajcik
Copy link
Contributor Author

Hi @AARON-CLARK
This PR will be superceded by Add Package Dependencies to Reports #723
So no need to merge this one

@AARON-CLARK AARON-CLARK marked this pull request as draft December 14, 2023 13:25
@AARON-CLARK
Copy link
Collaborator

Okay, converting to draft. But my comments above apply for any future PRs. I assume #723 will require syncing the tinytex installation?

@Robert-Krajcik
Copy link
Contributor Author

I would try using tinytex::install_prebuilt()

@Robert-Krajcik
Copy link
Contributor Author

Redundant with #734, which was merged yesterday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants