! Package fontspec Error: The font "Arial" cannot be found.Error in : LaTeX failed to compile built_report.tex. shinyapps.io - deployment

I developed shiny app that produces PDF files with in local machine without any hassle but when I upload it on shinyapps.io, it is successfully uploaded but it does not download pdf. Instead, it downloads report.htm, a blank file with Failed-Server Problem. When I look at the log, it points to "Can't find Arial file" and do not find 'build_report.tex' file. Help me out. I can't find solution.
YAML of my rmarkdown file is:
---
title:
header-includes: \let\Begin\begin \let\End\end \newcommand{\Newrow}{\\} \usepackage{fancyhdr}
\usepackage{graphicx} \usepackage{multicol} \usepackage[fontsize=14pt]{scrextend}
\usepackage[T1]{fontenc} \usepackage{tcolorbox} \usepackage{amssymb} \usepackage{tgtermes}
\usepackage{lscape}
\usepackage{multicol}
\usepackage{fontspec}
mainfont: Arial
output:
pdf_document:
latex_engine: xelatex
fig_caption: yes
highlight: pygments
number_sections: yes
keep_tex: yes
includes:
in_header: columns2.tex
word_document: default
html_document:
df_print: paged
monofont: Times New Roman
indent: yes
spacing: single
fig-caption: yes
geometry: left=1in, top=1in, right=1in, bottom=1in
sansfont: Arial
always_allow_html: yes
classoption: openany
params:
file: NA
cmede: NA
cklant: NA
nmede: NA
nklant: NA
---
The log extracted from shinyapps.io is shown in image file below:

Related

VSCode LaTeX nicematrix

I want to use the package "nicematrix" in VSCode, but it's not working the way I tried.
\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{mathtools,halloweenmath}
\usepackage{stackengine}
\usepackage{nicematrix}
\begin{document}
\begin{vNiceMatrix}[first-row,last-row,first-col,last-col]
(I)&&x-&y+2z=1 \\
(II)-2x-5y+7z=0 & +2 \cdot (I)\\
(III)&5x+&y-3z=-11 & (-5) \cdot (I)
\end{vNiceMatrix}
\end{document}
The output should look like in this image, but it can't generate an pdf-file.
enter image description here
I get the following error:
Fatal Package nicematrix: Outside math mode. LaTeX [line 1, column 1]
(nicematrix) The environment {vNiceMatrix} can be used
(nicematrix) only in math mode (and not in \vcenter).
(nicematrix) This error is fatal.
The next big problem is, that a pdf can't be created:
Emergency stop LaTeX [line 256, column 1]
:256: ==> Fatal error occurred, no output PDF file produced!Latexmk: Getting log file 'ombplus.log' Latexmk: Examining 'ombplus.fls
Latexmk: Examining 'ombplus.log
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
If I click on the problem with line 256, I get this message:
The Editor couldn't be open due to an unexpected error: The file "..." can't be read (Unknown (FileSystemError): TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string or Uint8Array without null bytes. Received 'file(...)/\x00'). Button: Try Again
How I can use the package "nicematrix" in VSCode?
I want to use the package "nicematrix", but VSCode doesn't recognise the package "nicematrix".
I downloaded it with the MikTeX-program: "miktex-pdftex" and this opens automically a "package-installer", if I include a new package in VSCode. Then I tried it with a download of this package in CTAN. It's not working this way.
The error is caused by the missing math environment around your nicematrix, add for example \[...\] for an unnumbered equation.
I also think with NiceArray you'll get better alignment:
\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{mathtools,halloweenmath}
\usepackage{stackengine}
\usepackage{nicematrix}
\begin{document}
\[
\begin{NiceArray}{l|rlll|l}
\text{(I)} &x &-y &+2z &=1 & \\
\text{(II)} &-2x &-5y &+7z &=0 & +2 \cdot \text{(I)}\\
\text{(III)} &5x &+y &-3z &=-11 & (-5) \cdot \text{(I)}
\end{NiceArray}
\]
\end{document}

Rmarkdown knitting to markdown changes hashed headers

I am trying to knit from Rmarkdown to markdown.
When knitting
---
output: md_document
---
# Header 1
## Header 2
I get
Header 1
========
Header 2
--------
but I want the Headers to remain hashed which is valid markdown. How can I accomplish this from within the Rmd?
It works with
---
output:
html_document:
keep_md: true
---
but since I am conditionally compiling different content in the actual rmarkdown to html and md I cannot use this option.
When you run
---
output:
html_document:
keep_md: true
---
# Header 1
## Header 2
In the present working directory of this .Rmd file, Rstudio/Rmarkdown should render a .md file that is the actual Markdown file, while also rendering an HTML file. Which, when opens, shows the code just like the .RMD file has
This link May also give some more info regarding Rmarkdon YAML options for more markdown control.

Where is the .tex file kept when compiling Rmd in Rstudio server

This may sound like a dumb question, but I'd like to know where is the .tex file saved, when I compile a pdf document from a Rmd file, using RStudio server.
I added the keep_tex option, so the header of Rmd looks like this :
---
output:
pdf_document:
keep_tex: yes
---
Then when I compiled, the output looks like this
|...................... | 33%
ordinary text without R code
|........................................... | 67%
label: plot
processing file: test.Rmd
cropping /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test_files/figure-latex/plot-1.pdf
PDFCROP 1.33, 2012/02/01 - Copyright (c) 2002-2012 by Heiko Oberdiek.
==> 1 page written on `/tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test_files/figure-latex/plot-1.pdf'.
|.................................................................| 100%
ordinary text without R code
/usr/lib/rstudio-server/bin/pandoc/pandoc test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.tex --template /home/myusername/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in'
output file: test.knit.md
/usr/lib/rstudio-server/bin/pandoc/pandoc test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.pdf --template /home/myusername/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in'
Output created: /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.pdf
I'd like to find the intermediate .tex file (or test.knit.md), and do a bit of editing. Except it is no where to be found. Not in the working directory, or /home/myusername/, or /, or /tmp/Rtmpb1x3Q0/.
I'd really appreciate it if someone has the answer.
Actually, this first line in the console
/usr/lib/rstudio-server/bin/pandoc/pandoc test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.tex --template /home/myusername/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in'
told us that the output .tex file is in /tmp/Rtmpb1x3Q0/preview-3bfe24922427.dir/test.tex
Somehow I did not find the file last time, but on a recent instance, the .tex file is actually there, so that answers the question.
The initial code from the question
---
output:
pdf_document:
keep_tex: yes
---
Throws an error for me, while the following does not:
---
output:
pdf_document: default
keep_tex: T
---
However, I was still unable to find the .tex file following the console output. It appears to still not be saved. Instead what worked easily was running the following lines in the R studio console:
#install.packages(rmarkdown)
rmarkdown::render("FileName.Rmd", output_format = latex_document())
The file "FileName.Rmd" needs to be in the current working directory - which is where the .tex file will be saved.

Tesseract OCR mftraining Error code 2001 with 2 fonts in the font_properties file

I am trying create new language data for Japanese with 2 fonts.
1. Arial Unicode MS
2. MS ゴシック (MS Gothic)
I am not sure how to create font_properties file with command line for two fonts.
Usually I run > echo Arial_Unicode_MS 0 0 1 0 0 >font_properties -- to create font properties file with one font.
Since, I am going to use two fonts I edited the file to add the second font.
But, when I execute mftraining , for the first font whether it is Arial Unicode MS or MS ゴシック it just works fine. But I get "malloc allocation error 2001 iff I reference the second font in the file.
I even used Serak trainer to create font_properties file.
I want to do, as shown below.
1. mftraining.exe -F font_properties -U unicharset -O lang.unicharset lang.font1.exp0.tr
2.mftraining.exe -F font_properties -U unicharset -O lang.unicharset lang.font2.exp0.tr
#1 throws no error if font1 is the first font in the file. But getting error with #2
#2 throws no error if font2 is the first font in the file. But getting error with #1
What is wrong with my steps?
Regards,
Sharon
Your TIFF/Box files should have "Arial_Unicode_MS" in their names, not "font1" or "font2".

Multiple figures in one chunk with knitr and Rstudio 0.97 or 0.98

I try to shift from Sweave to knitr but I am stucked with a problem to use multiple plots in one chunk. Here an example:
Let this .Rnw simple file (named Essai.Rnw). Of course only one plot is shown in the pdf:
\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}
<<fig=TRUE>>=
plot(1:10, exp(1:10))
plot(1:10, log(1:10))
#
\end{document}
I transform it to knitr format using:
library("knitr", lib.loc="/Library/Frameworks/R.framework/Versions/3.0/Resources/library")
Sweave2knitr("Essai.Rnw")
I edit the file to get this:
\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}
<<include=FALSE>>=
require(knitr)
opts_chunk$set(concordance=TRUE)
#
<<>>=
plot(1:10, exp(1:10))
plot(1:10, log(1:10))
#
\end{document}
In Rstudio global preference, I set Weave Rnw files using Knitr and when I produce pdf file using Compile pdf button in Rstudio, i get only one plot, not the 2 as I expected.
Here is my sessionInfo()
> sessionInfo()
R version 3.0.1 Patched (2013-06-10 r62935)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.2
loaded via a namespace (and not attached):
[1] digest_0.6.3 evaluate_0.4.3 formatR_0.7 stringr_0.6.2 tools_3.0.1
Not sure this is the cause of your problem but if you weave it with knitr, I think you have to remove the \SweaveOpts{concordance=TRUE} line.
If I compile the following, I get two plots. Note the deletions I made. Your original code did not compile on my system.
\documentclass{article}
\begin{document}
<<include=FALSE>>=
opts_chunk$set(concordance=TRUE)
#
<<>>=
plot(1:10, exp(1:10))
plot(1:10, log(1:10))
#
\end{document}
Maybe read about the knitr option fig.keep= about how your plots get integrated into the output.