Skip to contentSkip to conversation

utilities: Add a script for automated latex package install

PATCH Applied SeongJae Park 3 participants 4 messages Mar 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 utilities: Add a script for automated latex package install

Installing version mismatch latex packages one by one in manual, as described in #10.A in FAQ-BUILD.txt is cumbersome. This commit adds a script for automation of the work.

---
 utilities/install_latex_package.sh | 44 ++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100755 utilities/install_latex_package.sh
utilities/install_latex_package.sh new file +44 -0
new file mode 100755
index 00000000..0a7f3d19
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+if [ $# -ne 1 ]
+then
+	echo "Usage: $0 <package name>"
+	exit 1
+fi
+
+package=$1
+
+packages="titlesec cleveref listings draftwatermark epigraph fvextra"
+supported="false"
+for p in $packages
+do
+	if [ "$package" == "$p" ]
+	then
+		supported="true"
+		break
+	fi
+done
+if [ "$supported" == "false" ]
+then
+	echo "$package is not supported"
+	exit 1
+fi
+
+wget "http://mirrors.ctan.org/macros/latex/contrib/$package.zip"
+unzip "$package.zip"
+cd "$package" || exit 1
+
+latex "$package.ins"
+if [ ! -e "$package.sty" ]
+then
+	echo "$package.sty creation failed"
+	exit 1
+fi
+
+install_dir=~/texmf/tex/latex/"$package"
+mkdir -p "$install_dir"
+cp "$package.sty" "$install_dir/"
+texhash ~/texmf
+
+cd .. || exit 1
+rm -fr "$package" "$package.zip"
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 FAQ-BUILD: Add a description for the automated latex package install script

This commit adds a description for the automated latex package install script, 'utilities/install_latex_package.sh'.

---
 FAQ-BUILD.txt | 6 ++++++
 1 file changed, 6 insertions(+)
FAQ-BUILD.txt +6 -0
index 0d3330b3..c0afc430 100644
@@ -210,6 +210,12 @@
 	    2.	Install it by following instructions at:
 		https://help.ubuntu.com/community/LaTeX#Installing_packages_manually
 
+	B.	Instead of above manual steps, you could install the package
+		using a script in this repository,
+		'./utilities/install_latex_package.sh'.  For example:
+
+			$ ./utilities/install_latex_package.sh epigraph
+
 11.	Is it possible to generate SyncTeX database file?
 
 	A.	Yes, it is. Setting an environment variable:
Signature · 1 line
2.17.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] FAQ-BUILD: Add a description for the automated latex package install script

Quoted 16 lines · SeongJae Park

This commit adds a description for the automated latex package install script, 'utilities/install_latex_package.sh'.

---
 FAQ-BUILD.txt | 6 ++++++
 1 file changed, 6 insertions(+)
FAQ-BUILD.txt +0 -0
index 0d3330b3..c0afc430 100644
@@ -210,6 +210,12 @@
 	    2.	Install it by following instructions at:
 		https://help.ubuntu.com/community/LaTeX#Installing_packages_manually

FAQ-BUILD.txt line 221

Quoted 10 lines
FAQ-BUILD.txt +6 -0
 
+	B.	Instead of above manual steps, you could install the package
+		using a script in this repository,
+		'./utilities/install_latex_package.sh'.  For example:
+
+			$ ./utilities/install_latex_package.sh epigraph
+
 11.	Is it possible to generate SyncTeX database file?
 
 	A.	Yes, it is. Setting an environment variable:

For both 1/2 and 2/2,

Thanks, Akira

#3 lore raw

Re: [PATCH 2/2] FAQ-BUILD: Add a description for the automated latex package install script

Quoted 25 lines · Akira Yokosawa
Quoted 24 lines · SeongJae Park

This commit adds a description for the automated latex package install script, 'utilities/install_latex_package.sh'.

---
 FAQ-BUILD.txt | 6 ++++++
 1 file changed, 6 insertions(+)
FAQ-BUILD.txt +6 -0
index 0d3330b3..c0afc430 100644
@@ -210,6 +210,12 @@
 	    2.	Install it by following instructions at:
 		https://help.ubuntu.com/community/LaTeX#Installing_packages_manually
 
+	B.	Instead of above manual steps, you could install the package
+		using a script in this repository,
+		'./utilities/install_latex_package.sh'.  For example:
+
+			$ ./utilities/install_latex_package.sh epigraph
+
 11.	Is it possible to generate SyncTeX database file?
 
Quoted 6 lines

FAQ-BUILD.txt line 221

Quoted 2 lines
FAQ-BUILD.txt +0 -0
 	A.	Yes, it is. Setting an environment variable:

For both 1/2 and 2/2,

Applied, thank you both!

Thanx, Paul