From 91f655e744f7e3d56193964963c56ce3d5da69c4 Mon Sep 17 00:00:00 2001 From: Taha Ahmed Date: Tue, 29 Mar 2011 15:58:17 +0200 Subject: [PATCH] I made a few changes to suit my needs bettter. Moved template to /common/tex Added siunitx, mhchem, and related commands to template preamble Use basename of tikz-file as pdf filename instead of the generic "template" --- tikz2pdf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tikz2pdf b/tikz2pdf index f96bf14..37ca846 100755 --- a/tikz2pdf +++ b/tikz2pdf @@ -33,6 +33,8 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. +# +# With a few changes by me 2011-03-29 /Taha Ahmed import sys, os.path, subprocess, glob, time, optparse, tempfile @@ -49,14 +51,14 @@ op.add_option("-s", "--view", action = "store_true", options, args = op.parse_args() tikzName, = args # exactly one filename expected -basename = "tikz2pdf_temp" +basename = os.path.splitext(tikzName)[0] # equivalent to basename(tikzName) in R texName = basename + ".tex" pdfName = basename + ".pdf" -templateFilename = os.path.expanduser("~/.tikz2pdf.tex") +templateFilename = os.path.expanduser("/home/taha/chepec/chetex/common/tex/tikz2pdf.tex") searchDir = os.getcwd() while searchDir != "/": - candidate = os.path.join(searchDir, ".tikz2pdf.tex") + candidate = os.path.join(searchDir, "tikz2pdf.tex") if os.path.exists(candidate): templateFilename = candidate sys.stdout.write("Using template %r.\n" % candidate) @@ -143,4 +145,3 @@ for temp in glob.glob("tikz2pdf_temp.*"): verboseUnlink(temp) # for ext in (".aux", ".log"): # verboseUnlink(basename + ext) -