Latex language package installation not working

Hi,

I am trying to install babel-icelandic for correct hyphenation of words in Rmarkdown. I've followed the directions here:

yet I still don't get correctly hyphenated words.

I get an error message about hyphen-icelandic (see below), yet I've also installed that through the shell.

Error message:

tlmgr install hyphen-icelandic
(running on Debian, switching to user mode!)
Unknown directive ...containerchecksum 57a177b65450718631f36bfd8db0f2d1bff788f3bf147137b6412714cc945c7e08832f14f9e7e659adf7e072a91f13a2ea27fe3161cd9b60313bc956f1f543c6... , please fix it! at /usr/share/texlive/tlpkg/TeXLive/TLPOBJ.pm line 210, <$retfh> line 5924.
tlmgr update --self
(running on Debian, switching to user mode!)
Unknown directive ...containerchecksum 57a177b65450718631f36bfd8db0f2d1bff788f3bf147137b6412714cc945c7e08832f14f9e7e659adf7e072a91f13a2ea27fe3161cd9b60313bc956f1f543c6... , please fix it! at /usr/share/texlive/tlpkg/TeXLive/TLPOBJ.pm line 210, <$retfh> line 5924.
fmtutil [ERROR]: format directory not writable: /var/lib/texmf/web2c
tlmgr install hyphen-icelandic
(running on Debian, switching to user mode!)
Unknown directive ...containerchecksum 57a177b65450718631f36bfd8db0f2d1bff788f3bf147137b6412714cc945c7e08832f14f9e7e659adf7e072a91f13a2ea27fe3161cd9b60313bc956f1f543c6... , please fix it! at /usr/share/texlive/tlpkg/TeXLive/TLPOBJ.pm line 210, <$retfh> line 5924.
(running on Debian, switching to user mode!)
tlmgr: action `path' not supported in usermode!

Output created: skilaverkefni2.pdf
Warning message:
Package babel Warning: No hyphenation patterns were preloaded for
(babel) the language `Icelandic' into the format.
(babel) Please, configure your TeX system to add them and
(babel) rebuild the format. Now I will use the patterns
(babel) preloaded for english instead on input line 54.

The example was installing babel-spanish, if you replace that with hyphen-icelandic what happens?

rstudio-user@application-1753700-deployment-4935334-b4b9t:/cloud/project$ tlmgr init-usertree
(running on Debian, switching to user mode!)
tlmgr: action init-usertree returned a warning.
rstudio-user@application-1753700-deployment-4935334-b4b9t:/cloud/project$ tlmgr option repository ftp://tug.org/historic/systems/texlive/2015/tlnet-final
(running on Debian, switching to user mode!)
tlmgr: setting default package repository to ftp://tug.org/historic/systems/texlive/2015/tlnet-final
rstudio-user@application-1753700-deployment-4935334-b4b9t:/cloud/project$ tlmgr --usermode --no-persistent-downloads install hyphen-icelandic
(running on Debian, switching to user mode!)
TeX Live 2015 is frozen forever and will no
longer be updated.  This happens in preparation for a new release.

If you're interested in helping to pretest the new release (when
pretests are available), please read http://tug.org/texlive/pretest.html.
Otherwise, just wait, and the new release will be ready in due time.
tlmgr: package repository ftp://tug.org/historic/systems/texlive/2015/tlnet-final
[1/2, ??:??/??:??] install: hyph-utf8 [1002k]
[2/2, 00:02/00:02] install: hyphen-icelandic [1k]
tlmgr: package log updated: /home/rstudio-user/texmf/web2c/tlmgr.log
running mktexlsr ...
done running mktexlsr.
regenerating language.dat
TLUtils::_create_config_files: /home/rstudio-user/texmf/texmf-dist/tex/generic/config/language.us:  head file not found,ok in user modeCannot open /var/lib/texmf/tex/generic/config/language.dat for writing: Permission denied at /usr/share/texlive/tlpkg/TeXLive/TLUtils.pm line 2748.

I have no means of testing the success or not, though I am happy to play around if you share a reprex.

Thank you for your quick response!

I switched the package to both babel-icelandic and hyphen-icelandic, but still got an error message.

Reprex:

I open a fresh project with no base project. I create a new .Rmd file, which prompts me to update several packages to be able to compile an rmarkdown document.

I open the terminal and type the code given in the previous community post:

tlmgr init-usertree
tlmgr option repository ftp://tug.org/historic/systems/texlive/2015/tlnet-final
tlmgr --no-persistent-downloads install babel-icelandic

I then try to knit to pdf the following rmarkdown file:

---
title: ""
author: ""
date: ""
output:
  pdf_document: default
header-includes: 
   - \usepackage[icelandic]{babel}
---

Í þessu verkefni munt þú vinna með gögn um Alþingismenn og ræður á Alþingi frá 1991 til 2018. Upprunalegu gögnin eru aðgengileg á vef Alþingis, en xxxxx xxxxx xxxxx hefur umbreytt og bætt við ýmsum viðbótarupplýsingum við gögnin. 

The file above compiles, but with several warning messages, including:

Warning message:
Package babel Warning: No hyphenation patterns were preloaded for
(babel) the language `Icelandic' into the format.
(babel) Please, configure your TeX system to add them and
(babel) rebuild the format. Now I will use the patterns
(babel) preloaded for english instead on input line 54.

Obviously, the resulting pdf file includes incorrectly hyphenated words. "Upprunalega" should be hyphenated as such, upp-runa-lega.

I hope this gives you sufficient information to troubleshoot.

Apparently one of the limits of the usermode of tlmgr is the inability to update the language.

I just learned about tinytex today, and have been trying to get this to work. I don't get errors, but I also don't see hyphenation as you describe. Feel free to play with what I did and see if you can get further.

I will speak with the team about swapping the system texlive installation for one based on tinytex that allows users to more easily install what they need.

Many thanks for your work on this, Josh!

I opened the workspace and I notice that the PDF you generated has the correct hyphenation: Upp-runalega, rather than Up-prunalega (the word should either break upp-runalega or uppruna-lega).

However, when I knit your document, I do get an error:

tlmgr search --file --global '/icelandic.ldf'
cannot setup TLPDB in /home/rstudio-user/texmf at /usr/bin/tlmgr line 5604.
! Package babel Error: Unknown option `icelandic'. Either you misspelled it
(babel) or the language definition file icelandic.ldf was not fo
und.

Error: LaTeX failed to compile Testing1.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Testing1.log for more info.
In addition: Warning messages:
1: In system2("tlmgr", args, ...) :
running command ''tlmgr' search --file --global '/icelandic.ldf'' had status 2
2: In parse_packages(logfile, quiet = !verbose) :
Failed to find a package that contains icelandic.ldf
Execution halted

No worries for now - I'm happy to hear that you'll consider swapping to tinytex.

How are you knitting?
When I use the Knit button it works as expected.

I open the project, open the Rmd file and press the Knit button. Nothing else. Always get the error above.

So, my Rmd did not have anything to ensure that tinytex had been installed. Since it installs into the home directory, your copy didn't have it.

Here is another project that ensures the installation. Let me know if that works for you.

Hi Josh,

This one works!

When I run the code with

header-includes:

  • \usepackage[icelandic]{babel}

the hyphenation is correct. When I comment it out, the hyphenation is incorrect.

Just to clarify: Could I install tinytex + babel-icelandic on my end right now, or is that something that requires action on the server side?

I did absolutely nothing special. The Rmd will install tinytex if it is not already present.

For posterity in community:

---
title: ""
author: ""
date: ""
output:
  pdf_document:
    keep_md: true
    keep_tex: true
header-includes: 
   - \usepackage[icelandic]{babel}
---


```{r}
library(tinytex)
options(tinytex.verbose = TRUE)
options(tinytex.clean = FALSE)
if (!dir.exists('~/.TinyTeX')) {
  install_tinytex()
}

Sys.getenv("PATH")

Í þessu verkefni munt þú vinna með gögn um Alþingismenn og ræður á Alþingi frá 1991 til 2018. Upprunalegu gögnin eru aðgengileg á vef Alþingis, en xxxxx xxxxx xxxxx hefur umbreytt og bætt við ýmsum viðbótarupplýsingum við gögnin.