summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Dupeyron <calchan@gentoo.org>2013-11-04 19:33:21 +0000
committerDenis Dupeyron <calchan@gentoo.org>2013-11-04 19:33:21 +0000
commit987e9782d3a5e9d3d8df75b507129e3eedc0e9e8 (patch)
tree2ca18483264f41a6424f1e091509de4f081ff84f /dev-tex
parentAdd ~arm and ~mips keywords (diff)
downloadgentoo-2-987e9782d3a5e9d3d8df75b507129e3eedc0e9e8.tar.gz
gentoo-2-987e9782d3a5e9d3d8df75b507129e3eedc0e9e8.tar.bz2
gentoo-2-987e9782d3a5e9d3d8df75b507129e3eedc0e9e8.zip
Change CM2pdf into cm2pdf. Add variable font size and a --help option.
(Portage version: 2.2.7/cvs/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'dev-tex')
-rw-r--r--dev-tex/circuit_macros/ChangeLog8
-rw-r--r--dev-tex/circuit_macros/circuit_macros-7.7-r1.ebuild54
-rwxr-xr-xdev-tex/circuit_macros/files/cm2pdf72
-rw-r--r--dev-tex/circuit_macros/metadata.xml2
4 files changed, 134 insertions, 2 deletions
diff --git a/dev-tex/circuit_macros/ChangeLog b/dev-tex/circuit_macros/ChangeLog
index 0fe88aaa30ef..1a55c62773c1 100644
--- a/dev-tex/circuit_macros/ChangeLog
+++ b/dev-tex/circuit_macros/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for dev-tex/circuit_macros
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-tex/circuit_macros/ChangeLog,v 1.3 2013/10/29 14:58:48 calchan Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-tex/circuit_macros/ChangeLog,v 1.4 2013/11/04 19:33:20 calchan Exp $
+
+*circuit_macros-7.7-r1 (04 Nov 2013)
+
+ 04 Nov 2013; Denis Dupeyron <calchan@gentoo.org>
+ +circuit_macros-7.7-r1.ebuild, +files/cm2pdf, metadata.xml:
+ Change CM2pdf into cm2pdf. Add variable font size and a --help option.
*circuit_macros-7.7 (29 Oct 2013)
diff --git a/dev-tex/circuit_macros/circuit_macros-7.7-r1.ebuild b/dev-tex/circuit_macros/circuit_macros-7.7-r1.ebuild
new file mode 100644
index 000000000000..c49863e073f8
--- /dev/null
+++ b/dev-tex/circuit_macros/circuit_macros-7.7-r1.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-tex/circuit_macros/circuit_macros-7.7-r1.ebuild,v 1.1 2013/11/04 19:33:20 calchan Exp $
+
+EAPI=5
+
+inherit unpacker texlive-common
+
+DESCRIPTION="M4 Macros for Electric circuit diagrams in TeX or LaTeX"
+HOMEPAGE="https://ece.uwaterloo.ca/~aplevich/Circuit_macros/"
+SRC_URI="http://mirrors.ctan.org/graphics/circuit_macros.zip -> circuit_macros-${PV}.zip"
+
+LICENSE="LPPL-1.3c"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc examples +script"
+
+DEPEND=""
+RDEPEND="|| ( app-text/texlive[graphics] app-text/texlive[pstricks] )
+ media-gfx/dpic
+ sys-devel/m4
+ script? ( app-text/texlive[graphics]
+ dev-texlive/texlive-latexextra )"
+
+S="${WORKDIR}/${PN}"
+
+src_compile() {
+ :
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins *.m4
+ insinto /usr/share/texmf-site/tex/latex/${PN}
+ doins boxdims.sty
+ dodoc README CHANGES Makefile doc/CMman.pdf
+ rm -f doc/CMman.pdf
+ use doc && dodoc -r doc
+ use examples && dodoc -r examples
+ use script && dobin "${FILESDIR}/cm2pdf"
+ docompress -x \
+ /usr/share/doc/${PF}/Makefile \
+ /usr/share/doc/${PF}/doc \
+ /usr/share/doc/${PF}/examples
+}
+
+pkg_postinst() {
+ etexmf-update
+ use script && einfo "cm2pdf was installed to automatically create PDFs. Run cm2pdf --help for usage help."
+}
+
+pkg_postrm() {
+ etexmf-update
+}
diff --git a/dev-tex/circuit_macros/files/cm2pdf b/dev-tex/circuit_macros/files/cm2pdf
new file mode 100755
index 000000000000..893c59fe97b6
--- /dev/null
+++ b/dev-tex/circuit_macros/files/cm2pdf
@@ -0,0 +1,72 @@
+#! /bin/bash
+
+m4file=""
+fontsize=10
+
+usage() {
+ echo "Usage:"
+ echo "${0##*/} --help"
+ echo "${0##*/} [options] path/to/file.m4"
+ echo
+ echo "--help"
+ echo " Show this help message."
+ echo
+ echo "-f, --fontsize"
+ echo " Set size of base font, in points."
+ echo " Supported font sizes are 8, 9, 10, 11, 12, 14, 17 and 20."
+ exit
+}
+
+if [[ "$#" == 0 ]]; then usage; fi
+
+while [[ "$#" != 0 ]]; do
+ case "${1}" in
+ -h|--help)
+ usage;;
+ -f|--fontsize)
+ case "${2}" in
+ 8)
+ fontsize=8;;
+ 9)
+ fontsize=9;;
+ 10)
+ fontsize=10;;
+ 11)
+ fontsize=11;;
+ 12)
+ fontsize=12;;
+ 14)
+ fontsize=14;;
+ 17)
+ fontsize=17;;
+ 20)
+ fontsize=20;;
+ *)
+ echo "Unsupported font size: ${2}"
+ exit;;
+ esac
+ shift; shift;;
+ *.m4)
+ m4file="${1}"
+ shift;;
+ *)
+ echo "Unknown option: ${1}"
+ exit
+ esac
+done
+
+if [[ "${m4file}" == "" ]]; then
+ echo "No m4 input file"
+ exit
+fi
+
+tempdir=$(mktemp -d)
+cp -f "${m4file}" "${tempdir}/source.m4"
+pushd "${tempdir}" > /dev/null
+
+m4 -I /usr/share/circuit_macros pgf.m4 source.m4 | dpic -g > source.tex
+pdflatex "\documentclass[preview=true]{standalone}\usepackage{tikz,boxdims}\usepackage[${fontsize}pt]{extsizes}\begin{document}\input source.tex\end{document}"
+
+popd > /dev/null
+cp "${tempdir}/standalone.pdf" "${m4file%.m4}.pdf"
+rm -rf "${tempdir}"
diff --git a/dev-tex/circuit_macros/metadata.xml b/dev-tex/circuit_macros/metadata.xml
index 2bb86304fa57..239ba2086e69 100644
--- a/dev-tex/circuit_macros/metadata.xml
+++ b/dev-tex/circuit_macros/metadata.xml
@@ -12,7 +12,7 @@
examples of other types of diagrams.
</longdescription>
<use>
- <flag name="script">Install CM2pdf to automatically create a correctly
+ <flag name="script">Install cm2pdf to automatically create a correctly
sized PDF from a circuit_macro m4 source
</flag>
</use>