Papaja and quarto - papaja

Has anyone looked into using papaja with quarto, yet?
I've tried rendering a qmd file with
format:
papaja::apa6_pdf:
latex_engine: lualatex
keep_tex: true
in the header, but in seems that the render fails because of invalid YAML.

Related

How to add Babel support for nullishCoalescingOperator to vue project?

In my Vue-CLI project, when I tried using the ?? operator, I got this error:
Syntax Error: SyntaxError: /Users/stevebennett/odev/freelancing/v-map/src/components/Map.vue: >Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (30:29):
...
Add #babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.
I installed #babel/plugin-syntax-nullish-coalescing-operator (its name seems to have changed), added it to my babel.config.js:
module.exports = {
presets: ['#vue/app'],
plugins: ['#babel/plugin-syntax-nullish-coalescing-operator'],
};
Now the error message seems to have gone backwards, no reference to the operator name at all:
Module parse failed: Unexpected token (39:35)
You may need an appropriate loader to handle this file type.
| case 8:
| points = _context.sent;
console.log(sheetID ?? 37);
What am I doing wrong?
For me, the #babel/plugin-syntax-nullish-coalescing-operator plugin would not work, which is the one you are using.
I had to use the #babel/plugin-proposal-nullish-coalescing-operator plugin which is the one that the error message suggests you use.
Additionally, I noticed this on the page for the #babel/plugin-syntax-nullish-coalescing-operator plugin:
I can't say for sure if this will fix your problem, but it certainly fixed mine

How do I pass a tex template to Rmarkdown?

I want rmarkdown/knitr to create a pdf output using a custom tex template.
It is possible to override pandoc defaults with:
output:
pdf_document:
pandoc_args: '--pdf-engine=xelatex'
---
However it is not working when I add a further command:
'--pdf-engine=xelatex --template template.tex'
The error:
Unknown option --template template.tex .
How can I set a custom tex template using rmarkdown?
Much easier solution:
mainfont: Minion Pro
output:
pdf_document:
latex_engine: xelatex
---

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.

jekyll with broken front matter, how to find the broken file?

When I make a syntax error in the front matter i'm getting the following error:
/.../psych.rb:203:in `parse': (<unknown>): could not find expected
':' while scanning a simple key at line 6 column 1
(Psych::SyntaxError)
from /.../psych.rb:203:in `parse_stream'
from /.../psych.rb:151:in `parse'
from ....
Do you know a way to tell what file caused the problem?
I know that I could probably use DTrace as follows:
dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0)); }'| grep _posts
But I'm looking for something more straight forward.
it seams that jekyll does not work well on ruby 1.9.3. A more restrictive yaml parser was introduced: Psych that probably has different exception hierarchy and there for it is not properly handled by jekyll.
You may find that this is caused by faulty formatting
If your front matter looks like this:
---
menu:
- text: Home
url: /en/index.html
- text: Overview
url: /en/overview.html
---
instead of
---
menu:
- text: Home
url: /en/index.html
- text: Overview
url: /en/overview.html
---
then the YAML parser will throw it out.

Unable to run jekyll

I use Github pages to host my websites,I have test it on my local machine, and it works well, but when I push my sites on Github, I got an error. It says
The page build failed with the following error:
unable to run jekyll
My _config.yml file
---
auto : false
lsi : false
pygments : true
permalink : none
markdown : maruku
maruku:
use_divs: true
use_tex: true
png_engine : blahtex
png_dir : images/latex/
png_url : /images/latex/
I have searched the web, but can't find any useful ideas. Who can help me?
I have resorted to Github, they sent me the log, here is the error:
Maruku: Using extended syntax for div elements.\nMaruku: Using LaTeX extension. Images in images/latex/.\n/var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/ext/math/mathml_engines/blahtex.rb:40:in convert_to_png_blahtex': Blahtex error: empty output (RuntimeError)\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/ext/math/to_html.rb:64:in send'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/ext/math/to_html.rb:64:in render_png'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/ext/math/to_html.rb:120:in to_html_equation'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:970:in send'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:970:in array_to_html'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:961:in each'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:961:in array_to_html'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:956:in children_to_html'\n\tfrom /var/lib/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:50:in to_html'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/converters/markdown.rb:120:in convert'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/convertible.rb:46:in transform'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/convertible.rb:84:in do_layout'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/post.rb:189:in render'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/site.rb:193:in render'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/site.rb:192:in each'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/site.rb:192:in render'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/../lib/jekyll/site.rb:40:in process'\n\tfrom /var/lib/gems/1.8/gems/jekyll-0.11.0/bin/jekyll:250\n\tfrom /var/lib/gems/1.8/bin/jekyll:19:in `load'\n\tfrom /var/lib/gems/1.8/bin/jekyll:19\n"
From the log, We can see the problem is `convert_to_png_blahtex': Blahtex error: empty output (RuntimeError). I read the blahtex code,
if png.name != 'png'
maruku_error "Blahtex error: \n#{doc}"
return nil
end
But, png files are there. Anyone has encountered this problem?
I'm not sure the _config.yml file is the problem. I've pushed an invalid one to my site and the pages still render fine. That said, try removing your _config.yml all together. Github pages work fine without it for me. If the page still fails to render, you know it's something else.
Don't use maruku
maruku hasnt had an update since June 2010.
Personally I prefer kramdown.