Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
120 lines (102 sloc) 4.16 KB

TinyTeX module

Convenience functions for TinyTeX.

I have started using TinyTeX to avoid having a gigantic TeX/LaTeX distribution on my system. This module has some convenience functions I have written to automate some things.

Table of Contents


Install the elvish-modules package using epm:

use epm

In your rc.elv, load this module:


For now, the only function is tinytex:install-by-file, which takes a filename, searches for the package which contains that file, and installs it. If only one package matches the file, everything happens automatically:

[~]─> tinytex:install-by-file ifmtarg.sty
Installing package ifmtarg
tlmgr: package repository (verified)
[1/1, ??:??/??:??] install: ifmtarg [1k]
running mktexlsr ...
done running mktexlsr.
tlmgr: package log updated: /Users/taazadi1/Library/TinyTeX/texmf-var/web2c/tlmgr.log

If more than one package matches the file, it shows you the search results, and you can choose which of the matching packages you want to install:

[~]─> tinytex:install-by-file biber
There are multiple packages which contain a matching file:
tlmgr: package repository (verified)
0) 00texlive.image:
1) arara:
2) biber:
3) biber.amd64-freebsd:
4) biber.i386-cygwin:
5) biber.i386-freebsd:
17) dickimaw:
Please enter the numbers of the packages to install (comma-or-space-separated,
empty to cancel): 2
Packages selected: biber
Installing package biber
tlmgr: package repository (verified)
[1/2, ??:??/??:??] install: biber.x86_64-darwin [27656k]
[2/2, 00:13/00:13] install: biber [1k]
tlmgr: package log updated: /Users/taazadi1/Library/TinyTeX/texmf-var/web2c/tlmgr.log


Load libraries

use re

Install missing packages by file

If a LaTeX compile tells me a certain file is missing, I can just type tinytex:install-by-file <file>, which automates searching for the package which contains the file, and then installing it.

fn install-by-file [f]{
  search-res = [(tlmgr search --global --file "/"$f )]
  pkgs = [(each [l]{ if (eq $l[-1] ":") { put $l[0:-1] } } $search-res)]
  if (> (count $pkgs) 1) {
    i = 0
    echo (styled "There are multiple packages which contain a matching file:" blue)
    each [l]{
      if (eq $l[-1] ":") {
        echo (styled $i") "$l yellow)
        i = (+ $i 1)
      } else {
        echo $l
    } $search-res
    print (styled "Please enter the numbers of the packages to install (comma-or-space-separated, empty to cancel): " blue)
    resp = (read-upto "\n")[0:-1]
    pkgs = [(re:split "[, ]+" $resp | each [n]{ if (not-eq $n '') { put $pkgs[$n] } })]
    if (> (count $pkgs) 0) {
      echo (styled "Packages selected: "(joins ", " $pkgs) yellow)
  each [pkg]{
    echo (styled "Installing package "$pkg blue)
    tlmgr install $pkg
  } $pkgs
You can’t perform that action at this time.