rnuske / komaletter Goto Github PK
View Code? Open in Web Editor NEWR package for comfortable writing of beautiful PDF letters in Markdown.
Home Page: https://rnuske.github.io/komaletter
R package for comfortable writing of beautiful PDF letters in Markdown.
Home Page: https://rnuske.github.io/komaletter
Unfortunately, I am not able to knit documents using RStudio/Rmarkdown using komaletter
anymore (yields an error, because it calls the grffile
package, which is now a legacy package (thanks to @cderv for providing this related information caused by this):
This is related to other questions from a few days ago around the web:
https://superuser.com/questions/1500464/unable-to-knit-to-pdf-using-tinytex-missing-sty-file
Maybe be this one too: ho-tex/grffile#1It seems the
grffile
is now a legacy package and there was change in how this package is required or not.It has been removed from pandoc template a week ago jgm/pandoc@4d5fd9e with an issue to follow how it evolves. see jgm/pandoc#5848
Does anyone know how to work around this? I am trying to meet a deadline and am unable to use my letter templates now... :-(
Thank you for developing this interesting package.
Is there any way to produce a hyperlinked text without printing the URL as a footnote? I want to produce a clickable text.
Here is a snapshot of the following code line produces:
[linked text here](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)
I wanted to add a few references in a submission letter for a paper but I am getting an error.
I am adding the standard information for making references:
In the yaml:
bibliography: c:/data/references.bib
In the text:
[@vandijk2021]
but get the following error:
! LaTeX Error: Environment CSLReferences undefined.
I noticed that some other people had similar problems in other cases and the problem seems to be related with Pandoc, for example see: crsh/prereg#16.
I hope you can have a look.
Session info:
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] komaletter_0.4.2 compiler_4.0.5 fastmap_1.1.0 htmltools_0.5.2 tools_4.0.5 yaml_2.2.1 rmarkdown_2.11 knitr_1.36
[9] xfun_0.28 digest_0.6.28 rlang_0.4.12 evaluate_0.14
Hi
This looks great! I was wondering if there is a way (or a hack) to add subsections inside the letter.
Hi,
Thanks for the package.
How can I change the font.. it does not seem to be working?
And the return-address
show double. How can only keep the upper-left one?
If opening
is not set in the YAML metadata, the komaletter document can not be compiled. There should be a default for opening
to get rid of this error.
Hey,
I was wondering whether there is a way to add the address and return-address as parameters to the file. I am having trouble to add the linebreaks via parameters between the street, city and country. See the example below.
Best
Markus
---
return-address:
- Musterstr. 12
- 34567 Musterstadt
signature-before: 5\baselineskip
lco: DIN
lang: de
opening: Hey
closing: Best regards
params:
set_address: street\ncity\ncountry
subject: Test Letter
signature: signature here
address: "`r params$set_address`"
output: komaletter::komaletter
---
test letter.
This file,
---
lco: DIN
lang: fr
author: John Doe
return-address:
- Address 1
- Address 1
return-email: [email protected]
return-phone: +01 234 567890
address:
- Rob Recipient
subject: The Subject
opening: Opening
closing: Closing
mainfont: "Avenir Next"
sansfont: "Avenir Next"
output:
komaletter::komaletter:
latex_engine: xelatex
---
Text.
knit from within RStudio (details below) fails with the message
==> rmarkdown::render('/Users/nb/letters/test.Rmd', encoding = 'UTF-8');
processing file: test.Rmd
|......................................................................| 100%
ordinary text without R code
output file: test.knit.md
/usr/local/bin/pandoc +RTS -K512m -RTS test.knit.md --to latex --from markdown+tex_math_single_backslash-autolink_bare_uris --output test.tex --lua-filter /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --embed-resources --standalone --template /Library/Frameworks/R.framework/Versions/4.2/Resources/library/komaletter/rmarkdown/templates/pdf/resources/template.tex --highlight-style tango --pdf-engine xelatex '--variable=lco_default:/Library/Frameworks/R.framework/Versions/4.2/Resources/library/komaletter/rmarkdown/templates/pdf/resources/maintainersDelight'
! Argument of \str_uppercase:n has an extra }.
<inserted text>
\par
l.46 \setmainlanguage[]{}
Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted
(Output is as expected if lang: fr
is removed.)
The error message suggests that the underlying problem might be the use of the polyglossia package no longer supported by more recent versions of pandoc – see JensErat/pandoc-scrlttr2#20 and Wandmalfarbe/pandoc-latex-template#278. Conclusion from these reports: A switch to the babel package is recommended.
R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)
RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_6_8) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36
komaletter 0.4.2
The table containing list of LCOs doesn't show up properly on the CRAN renederd version of the vignette.
Maybe the table formatting is not recognized
Thanks for developing this great package. Is there any way to prevent the sender address from appearing twice (under the name and above the recipient address). I'd ideally like to only feature the sender address in the top right.
A long return-adress defined in the YAML-header is wrapped into multiple lines. An probably undesired effect is that (after printing and careful folding) only the lowest line of the return-adress can be seen in the adress window of a standard envelope. The rest is hidden.
Currently, komaletter::komaletter()
output cannot be rendered on Windows platform.
Please refer to the following reproducible code:
test <- rmarkdown::draft(file = 'test',
template = 'pdf',
package = 'komaletter',
create_dir = FALSE,
edit = FALSE
)
rmarkdown::render(test, output_format = 'komaletter::komaletter')
#> processing file: test.Rmd
#> output file: test.knit.md
#> "C:/PROGRA~3/CHOCOL~1/bin/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+tex_math_single_backslash-autolink_bare_uris --output test.tex --template "C:\PROGRA~1\R\R-36~1.1\library\KOMALE~1\RMARKD~1\TEMPLA~1\pdf\RESOUR~1\template.tex" --highlight-style tango --pdf-engine pdflatex --lua-filter "C:/Program Files/R/R-3.6.1/library/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Program Files/R/R-3.6.1/library/rmarkdown/rmd/lua/latex-div.lua" "--variable=lco_default:C:/Program Files/R/R-3.6.1/library/komaletter/rmarkdown/templates/pdf/resources/maintainersDelight"
#> ! LaTeX Error: Missing \begin{document}.
#> Error: Failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
Created on 2019-11-22 by the reprex package (v0.3.0.9001)
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R version 3.6.1 (2019-07-05)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.1252
#> ctype English_United States.1252
#> tz America/New_York
#> date 2019-11-22
#>
#> - Packages -------------------------------------------------------------------
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.1)
#> backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.1)
#> cli 1.1.0 2019-03-19 [1] CRAN (R 3.6.1)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.1)
#> digest 0.6.22 2019-10-21 [1] CRAN (R 3.6.1)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.1)
#> fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.1)
#> highr 0.8 2019-03-20 [1] CRAN (R 3.6.1)
#> htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.1)
#> knitr 1.26.1 2019-11-19 [1] Github (yihui/knitr@3c89ab1)
#> komaletter 0.3.1.9000 2019-11-18 [1] Github (rnuske/komaletter@8b0cfa3)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.1)
#> pillar 1.4.2 2019-06-29 [1] CRAN (R 3.6.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.1)
#> purrr 0.3.3 2019-10-18 [1] CRAN (R 3.6.1)
#> Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.1)
#> reprex 0.3.0.9001 2019-11-13 [1] Github (tidyverse/reprex@27aa69a)
#> rlang 0.4.2 2019-11-22 [1] Github (r-lib/rlang@dbcb76f)
#> rmarkdown 1.17.4 2019-11-21 [1] Github (rstudio/rmarkdown@1e0964c)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.1)
#> stringi 1.4.3 2019-03-12 [1] CRAN (R 3.6.0)
#> stringr 1.4.0.9000 2019-11-11 [1] Github (hadley/stringr@80aaaac)
#> styler 1.2.0.9000 2019-11-13 [1] Github (r-lib/styler@a8acde5)
#> tibble 2.1.3 2019-06-06 [1] CRAN (R 3.6.1)
#> tinytex 0.17.1 2019-11-18 [1] Github (yihui/tinytex@4a251b5)
#> withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.1)
#> xfun 0.11.3 2019-11-22 [1] Github (yihui/xfun@4fcd6ff)
#> yaml 2.2.0 2018-07-25 [1] CRAN (R 3.6.0)
#>
#> [1] C:/Program Files/R/R-3.6.1/library
I would like to add the university logo to the top of the letter so it more-or-less replicates the standard template. I followed the approach as described here:
And added this in the yaml:
header-includes:
plus a header.tex with the following information in the same folder
\usepackage{fancyhdr}
\pagestyle{fancy}
\rhead{\includegraphics[width = .05\textwidth]{logo.png}}
Nothing, however, seems to happen. I suppose the header-includes is not supported (yet) by the package. Not sure if this is easy to implement but this seems to be a general feature that users would like to use.
Should it be possible to write a letter without adressing it?
At the moment komaletter crashes if no address is given.
Thank you very much for the package, it is really very useful. I know that usually a letter is only composed of a single page. However, when the body exceeds this limit (e.g. up to 2 pages), from the second page onwards the page number is shown at the bottom of each sheet. Of course this can be avoided by editing the .tex
template, but I leave the suggestion to make this a default feature. Thank you!
If I put the following table inside a document that outputs to komaletter::komaletter
I get an error.
| One Column | Another column with a very long but useless title |
| ------------------------------------------------- | ------------------------------------------------- |
| Another column with a very long but useless title | Another column with a very long but useless title |
The error message is
! Undefined control sequence.
<argument> @{} >{\raggedright \arraybackslash
}p{(\columnwidth - 2\tabcolsep...
l.99 ...nwidth - 2\tabcolsep) * \real{0.5000}}@{}}
Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted
I can resolve the error by adding the tabularx package as dependency to the YAML header:
output:
komaletter::komaletter:
extra_dependencies: ["tabularx"]
But now I get the following error:
! Missing number, treated as zero.
<to be read again>
(
l.102 \begin
{minipage}[b]{\linewidth}\raggedright
Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted
---
author: Max Mustermann
return-address:
- Musterstr. 12
- 34567 Musterstadt
address:
- Robert Nuske
- Hauptstr. 31
- 30167 Hannover
- Germany
subject: Some nonsensical Subject
opening: Dear Robert,
closing: Best regards,
signature: Max Mustermann
output:
komaletter::komaletter:
extra_dependencies: ["tabularx"]
---
| One Column | Another column with a very long but useless title |
| ------------------------------------------------- | ------------------------------------------------- |
| Another column with a very long but useless title | Another column with a very long but useless title |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.