help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: R, knitr and texlive on Guix (as a package manager)


From: Todor Kondić
Subject: Re: R, knitr and texlive on Guix (as a package manager)
Date: Thu, 15 Oct 2020 19:12:45 +0000

<tk.code@protonmail.com> wrote:

> Hello Guix,
>
> I am trying to generate a pdf report using R and knitr and PDF LaTeX. More 
> specifically, I was trying out a sample document that comes with knitr 
> package. This is the code to generate the output:
>
>     require(knitr)
>     s = system.file("misc", "stitch-test.R", package = "knitr")
>     stitch(s)
>
>
> Now, tangling this into a pdf revealed several missing LaTeX packages (which 
> I installed), but then it finally died with this error,
>
> output file: stitch-test.tex
>
> ! Math formula deleted: Insufficient symbol fonts.
> <inserted text> \setbox \z@ \vbox {\hbox {$($
>
>                                              }\\kern \\z@ }\\global 
> \\big@size 1.2\\ht \\z@
>
>
> l.87 T
> he results below are generated from an R script.
>
> Error: LaTeX failed to compile stitch-test.tex. See 
> https://yihui.org/tinytex/r/#debugging for debugging tips. See 
> stitch-test.log for more info.
>
> The full tangled tex file is all the way at the bottom;
>
> Looking through the log file, I noticed
>
> LaTeX Font Info: Try loading font information for T1+pplx on input line 76.
> LaTeX Font Info: No file T1pplx.fd. on input line 76.
>
> LaTeX Font Warning: Font shape `T1/pplx/m/n' undefined (Font) 
> using`T1/cmr/m/n' instead on input line 76.
>
> and also, a couple of additional font warnings just before the error,
>
> LaTeX Font Info: Try loading font information for OT1+pplx on input line 87.
> LaTeX Font Info: No file OT1pplx.fd. on input line 87.
>
> LaTeX Font Warning: Font shape `OT1/pplx/m/n' undefined (Font) 
> using`OT1/cmr/m/n' instead on input line 87.
>
> LaTeX Font Info: Try loading font information for OML+zplm on input line 87.
> LaTeX Font Info: No file OMLzplm.fd. on input line 87.
>
> LaTeX Font Warning: Font shape `OML/zplm/m/it' undefined (Font) 
> using`OML/cmm/m/it' instead on input line 87.
>
> LaTeX Font Info: Try loading font information for OMS+zplm on input line 87.
> LaTeX Font Info: No file OMSzplm.fd. on input line 87.
>
> LaTeX Font Warning: Font shape `OMS/zplm/m/n' undefined (Font) 
> using`OMS/cmsy/m/n' instead on input line 87.
>
> LaTeX Font Info: Try loading font information for OMX+zplm on input line 87.
> LaTeX Font Info: No file OMXzplm.fd. on input line 87.
>
> LaTeX Font Warning: Font shape `OMX/zplm/m/n' undefined (Font) 
> using`OMX/cmex/m/n' instead on input line 87.
>
> LaTeX Font Info: External font `cmex10' loaded for size
> (Font) <12> on input line 87.
> LaTeX Font Info: External font `cmex10' loaded for size
> (Font) <9> on input line 87.
> LaTeX Font Info: External font `cmex10' loaded for size
> (Font) <7> on input line 87.
> LaTeX Font Info: Try loading font information for OT1+zplm on input line 87.
> LaTeX Font Info: No file OT1zplm.fd. on input line 87.
>
> LaTeX Font Warning: Font shape `OT1/zplm/m/n' undefined (Font) 
> using`OT1/cmr/m/n' instead on input line 87.
>
> The tangled tex file itself uses T1 fonts,
>
>     \\usepackage[T1]{fontenc}
>
>
> I guess this is a question of installing the right texlive package, or font, 
> so I am wondering if any of you would have an idea which (texlive) package to 
> install. I found mention of those "*.fd" files in the psnfss package, but 
> installing it (texlive-latex-psnfss) did not change a thing.
>
> The entire tex file follows (try pdflatex stitch-test.tex):
> **************** stitch-test.tex *******************
> \documentclass{article}\usepackage[]{graphicx}\usepackage[]{color}
> % maxwidth is the original width if it is less than linewidth
> % otherwise use linewidth (to make sure the graphics do not exceed the margin)
> \makeatletter
> \def\maxwidth{ %
> \ifdim\Gin@nat@width>\linewidth
>
>     \\linewidth
>
>
> \else
> \Gin@nat@width
> \fi
> }
> \makeatother
>
> \definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
> \newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
> \newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
> \newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
> \newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
> \newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
> \newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
> \newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
> \newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
> \newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
> \let\hlipl\hlkwb
>
> \usepackage{framed}
> \makeatletter
> \newenvironment{kframe}{%
> \def\at@end@of@kframe{}%
> \ifinner\ifhmode%
> \def\at@end@of@kframe{\end{minipage}}%
> \begin{minipage}{\columnwidth}%
> \fi\fi%
> \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
> \colorbox{shadecolor}{##1}\hskip-\fboxsep
> % There is no \\@totalrightmargin, so:
> \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
> \MakeFramed {\advance\hsize-\width
> \@totalleftmargin\z@ \linewidth\hsize
> \@setminipage}}%
> {\par\unskip\endMakeFramed%
> \at@end@of@kframe}
> \makeatother
>
> \definecolor{shadecolor}{rgb}{.97, .97, .97}
> \definecolor{messagecolor}{rgb}{0, 0, 0}
> \definecolor{warningcolor}{rgb}{1, 0, 1}
> \definecolor{errorcolor}{rgb}{1, 0, 0}
> \newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX
>
> \usepackage{alltt}
> \usepackage[sc]{mathpazo}
> \renewcommand{\sfdefault}{lmss}
> \renewcommand{\ttdefault}{lmtt}
> \usepackage[T1]{fontenc}
> \usepackage{geometry}
> \geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
> \setcounter{secnumdepth}{2}
> \setcounter{tocdepth}{2}
> \usepackage[unicode=true,pdfusetitle,
> bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,
> breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
> {hyperref}
> \hypersetup{
> pdfstartview={XYZ null null 1}}
>
> \makeatletter
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
> \renewcommand{\textfraction}{0.05}
> \renewcommand{\topfraction}{0.8}
> \renewcommand{\bottomfraction}{0.8}
> \renewcommand{\floatpagefraction}{0.75}
>
> \makeatother
> \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
> \begin{document}
>
> \title{ A test script for the function stitch()}
>
> \author{ Yihui Xie%
> \thanks{This report is automatically generated with the R package 
> \textbf{knitr}
> (version 1.29).}}
>
> \maketitle
> The results below are generated from an R script.
>
> \begin{knitrout}
> \definecolor{shadecolor}{rgb}{0.969, 0.969, 
> 0.969}\color{fgcolor}\begin{kframe}
> \begin{alltt}
> \hlkwd{set.seed}\hlstd{(}\hlnum{1121}\hlstd{)}
> \hlstd{(x} \hlkwb{=} \hlkwd{rnorm}\hlstd{(}\hlnum{20}\hlstd{))}
> \end{alltt}
> \begin{verbatim}
>
> [1] 0.1449583 0.4383221 0.1531912 1.0849426 1.9995449 -0.8118832 0.1602680
>
> ---------------------------------------------------------------------------
>
> [8] 0.5858923 0.3600880 -0.0253084 0.1508809 0.1100824 1.3596812 -0.3269946
>
> ----------------------------------------------------------------------------
>
> [15] -0.7163819 1.8097690 0.5084011 -0.5274603 0.1327188 -0.1559430
>
> --------------------------------------------------------------------
>
> \end{verbatim}
> \begin{alltt}
> \hlkwd{mean}\hlstd{(x);}\hlkwd{var}\hlstd{(x)}
> \end{alltt}
> \begin{verbatim}
>
> [1] 0.3217385
>
> --------------
>
> [1] 0.5714534
>
> --------------
>
> \end{verbatim}
> \begin{alltt}
> \hlkwd{boxplot}\hlstd{(x)}
> \end{alltt}
> \end{kframe}
>
> {\centering 
> \includegraphics[width=.6\linewidth]{figure/stitch-test-Rnwauto-report-1}
>
> }
>
> \begin{kframe}\begin{alltt}
> \hlkwd{hist}\hlstd{(x,} \hlkwc{main} \hlstd{=} \hlstr{''}\hlstd{)}
> \end{alltt}
> \end{kframe}
>
> {\centering 
> \includegraphics[width=.6\linewidth]{figure/stitch-test-Rnwauto-report-2}
>
> }
>
> \end{knitrout}
>
> The R session information (including the OS info, R version and all
> packages used):
>
> \begin{knitrout}
> \definecolor{shadecolor}{rgb}{0.969, 0.969, 
> 0.969}\color{fgcolor}\begin{kframe}
> \begin{alltt}
> \hlkwd{sessionInfo}\hlstd{()}
> \end{alltt}
> \begin{verbatim}
>
> R version 4.0.2 (2020-06-22)
>
> -----------------------------
>
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> --------------------------------------------
>
> Running under: Pop!_OS 20.04 LTS
>
> ---------------------------------
>
> --
>
> Matrix products: default
>
> -------------------------
>
> BLAS/LAPACK: 
> /gnu/store/bs9pl1f805ins80xaf4s3n35a0x2lyq3-openblas-0.3.9/lib/libopenblasp-r0.3.9.so
>
> ---------------------------------------------------------------------------------------------------
>
> --
>
> locale:
>
> --------
>
> [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
>
> --------------------------------------
>
> [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
>
> -----------------------------------------------
>
> [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
>
> ----------------------------------------------------
>
> [7] LC_PAPER=en_GB.UTF-8 LC_NAME=en_GB.UTF-8
>
> ---------------------------------------------
>
> [9] LC_ADDRESS=en_GB.UTF-8 LC_TELEPHONE=en_GB.UTF-8
>
> ----------------------------------------------------
>
> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=en_GB.UTF-8
>
> --------------------------------------------------------------
>
> --
>
> attached base packages:
>
> ------------------------
>
> [1] stats graphics grDevices utils datasets methods base
>
> ---------------------------------------------------------
>
> --
>
> other attached packages:
>
> -------------------------
>
> [1] knitr_1.29 Rcpp_1.0.5
>
> --------------------------
>
> --
>
> loaded via a namespace (and not attached):
>
> -------------------------------------------
>
> [1] xfun_0.17 listenv_0.8.0 rJava_0.9-13
>
> -----------------------------------------
>
> [4] lattice_0.20-41 colorspace_1.4-1 vctrs_0.3.4
>
> -------------------------------------------------
>
> [7] stats4_4.0.2 fingerprint_3.5.7 yaml_2.2.1
>
> ----------------------------------------------
>
> [10] vsn_3.56.0 XML_3.99-0.5 rlang_0.4.7
>
> -----------------------------------------
>
> [13] pillar_1.4.6 glue_1.4.2 MSnbase_2.14.2
>
> --------------------------------------------
>
> [16] mzR_2.22.0 BiocParallel_1.22.0 affy_1.66.0
>
> ------------------------------------------------
>
> [19] BiocGenerics_0.34.0 affyio_1.58.0 foreach_1.5.0
>
> -----------------------------------------------------
>
> [22] lifecycle_0.2.0 plyr_1.8.6 stringr_1.4.0
>
> ----------------------------------------------
>
> [25] mzID_1.26.0 ProtGenerics_1.20.0 zlibbioc_1.34.0
>
> -----------------------------------------------------
>
> [28] munsell_0.5.0 pcaMethods_1.80.0 gtable_0.3.0
>
> --------------------------------------------------
>
> [31] rcdklibs_2.0 future_1.18.0 evaluate_0.14
>
> ----------------------------------------------
>
> [34] codetools_0.2-16 Biobase_2.48.0 IRanges_2.22.2
>
> ----------------------------------------------------
>
> [37] doParallel_1.0.15 parallel_4.0.2 highr_0.8
>
> ------------------------------------------------
>
> [40] itertools_0.1-3 preprocessCore_1.50.0 scales_1.1.1
>
> --------------------------------------------------------
>
> [43] BiocManager_1.30.10 limma_3.44.3 rcdk_3.4.3
>
> -------------------------------------------------
>
> [46] S4Vectors_0.26.1 impute_1.62.0 rjson_0.2.20
>
> -------------------------------------------------
>
> [49] ggplot2_3.3.2 png_0.1-7 digest_0.6.25
>
> -------------------------------------------
>
> [52] stringi_1.5.3 ncdf4_1.17 grid_4.0.2
>
> -----------------------------------------
>
> [55] RMassBank_2.99.2 tools_4.0.2 magrittr_1.5
>
> -----------------------------------------------
>
> [58] RCurl_1.95-0.1.2 tibble_3.0.3 crayon_1.3.4
>
> ------------------------------------------------
>
> [61] pkgconfig_2.0.3 enviPat_2.4 MASS_7.3-53
>
> ---------------------------------------------
>
> [64] ellipsis_0.3.1 iterators_1.0.12 R6_2.4.1
>
> ----------------------------------------------
>
> [67] globals_0.12.5 MALDIquant_1.19.3 compiler_4.0.2
>
> -----------------------------------------------------
>
> \end{verbatim}
> \begin{alltt}
> \hlkwd{Sys.time}\hlstd{()}
> \end{alltt}
> \begin{verbatim}
>
> [1] "2020-10-15 15:45:57 CEST"
>
> -------------------------------
>
> \end{verbatim}
> \end{kframe}
> \end{knitrout}
>
> \end{document}

Okay, after wasting few hours of my life installing various texlive package 
(did not help), I went for the full, ueber-bloated texlive distribution 
("texlive" package). Of course, this "solved" the knittr problem.

Interestingly, looking into $GUIX_PROFILE/share/texmf-dist/tex/latex/psnfss 
directory, I found bunch of *.fd files present that were not there when I tried 
to install texlive-latex-psnfss package individually. Perhaps a bug?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]