PoShTeX

PowerShell utilities for working with TeX and friends.

Currently experimental, but planned support for the following common yet annoying TeX tasks:

I guess that's about it? Oh, it should also be cross-platform.

Importantly, the following are not goals of PoShTeX, as they are already handled better by other projects:

Installing

To install released versions of PoShTeX, simply use PowerShellGet (built in to PowerShell for Windows 10, macOS / OS X and Linux; download PackageManagement to use PowerShellGet on Windows 7 and 8.1).

PS> Install-Module -Name posh-tex -Scope CurrentUser

We'll have instructions at some point for how to install development (unreleased) versions.

Using PoShTeX to Write Installers

The following example demonstrates how an installer could be written for {revquantum}.

#region Bootstrap PoShTeX
if (!(Get-Module -ListAvailable -Name posh-tex -ErrorAction SilentlyContinue)) {
    Install-Module posh-tex -Scope CurrentUser
}
Import-Module posh-tex
#endregion

Out-TeXStyle revquantum
Out-TeXStyleDocumentation revquantum

Install-TeXUserResource tex/latex/revquantum revquantum.sty, revquantum.pdf

Install-PandocUserResource templates pandoc/templates/revquantum.latex -ErrorAction Continue

The first few lines install PoShTeX if it is not already available, and should be included in any install script. The remaining lines specify that revquantum.dtx should be compiled into revquantum.sty using the associated revquantum.ins file, that the documentation PDF should be compiled, and that both of these resources should be installed into the current user's TeX root. The installer closes by attempting to also install the associated Pandoc template.

Using PoShTeX to Specify arXiv Manifests

PoShTeX also allows for creating arXiv-ready ZIP files with simple manifest scripts. Since arXiv only allows TeX projects that use folders to be uploaded as a ZIP, this can help authors organize their manuscript projects without sacrificing arXiv support. For instance, the following manifest might be used to produce a ZIP file for a paper on metalearning problems.

#region Bootstrap PoShTeX
if (!(Get-Module -ListAvailable -Name posh-tex -ErrorAction SilentlyContinue)) {
    Install-Module posh-tex -Scope CurrentUser
}
Import-Module posh-tex
#endregion

Export-ArXivArchive @{
    ProjectName = "mlp";
    TeXMain = "mlp.tex";
    AdditionalFiles = @{
        "fig/*.pdf" = $null;
        "revquantum.sty" = $null;
        "quantumarticle.cls" = $null;
    };
    Notebooks = @(
        "nb/paper-figures.ipynb"
    )
}

The resulting ZIP archive will contain all of the following files:

To ensure that everything works correctly, this manifest script will also recompile the manuscript.