Last active
November 3, 2018 14:17
-
-
Save epakai/3932bf3fa3823ce78903b0b1b5a28277 to your computer and use it in GitHub Desktop.
Document LaTeX \usepackage lines with CTAN caption in Vim. Requires one package per line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \usepackage{fancyhdr} % Extensive control of page headers and footers in LaTeX2e | |
| \usepackage{enumitem} % Control layout of itemize, enumerate, description | |
| \usepackage{multicol} % Intermix single and multiple columns | |
| \usepackage{multirow} % Create tabular cells spanning multiple rows | |
| \usepackage{mathtools} % Mathematical tools to use with amsmath | |
| \usepackage{amsthm} % Typesetting theorems (AMS style) | |
| \usepackage{amssymb} % | |
| \usepackage{amsfonts} % TeX fonts from the American Mathematical Society | |
| \usepackage{graphicx} % Enhanced support for graphics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Add descriptions to tex usepackage lines | |
| function! Texdesc() | |
| %s/^\\usepackage\(\[[a-zA-Z0-9_,-]*\]\)\={\([a-zA-Z0-9_-]\+\)}$/\=submatch(0) . ' % ' .substitute(system("~\/.local\/bin\/texdesc.sh ".submatch(2)), "\n", "", "")/g | |
| endfunction | |
| command! Texdesc call Texdesc() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Check if ctan package list exists | |
| if [ ! -e ~/.ctan_package_list ]; then | |
| curl -s --output ~/.ctan_package_list https://ctan.org/json/1.3/packages | |
| fi | |
| # Check if older than 15 days | |
| if test "$(find ~/.ctan_package_list -mtime +15)"; then | |
| curl -s --output ~/.ctan_package_list https://ctan.org/json/1.3/packages | |
| fi | |
| # Find caption for matching package name | |
| jq --raw-output '.[] | select(.name | match("^'$1'$"))| .caption' ~/.ctan_package_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment