{scripts} is for questions involving external scripts (small programs in source code form) related to (La)TeX.

learn more… | top users | synonyms (1)

146
votes
17answers
53k views

Is there any way to do a correct word count of a LaTeX document?

Often assignments (or even papers) have a word count limit. That is not a big deal when using Word, but I don't know how to do that using LaTeX. My solution has been so far to compile the document and ...
44
votes
3answers
6k views

Detecting all pages which contain color

In an larger LaTeX document there are often only some pages with color content (mainly figures) and the remaining ones are only black and white. Because printing costs for color pages are much higher ...
32
votes
7answers
3k views

What are the advantages of Lua over other scripting languages for a TeX implementation?

The question is inspired by Martin Schröder's answer to I am new to TeX. Should I use LaTeX, XeLaTeX, …? as well as my two previous questions on this forum: Automatic document update Generate LaTeX ...
24
votes
6answers
1k views

How can other programming languages and tools be used to create content for TeX documents?

When writing about programming languages or tools one often wants to include output from them in the document. Then it is useful if such output can be created as the document is compiled. For ...
20
votes
4answers
1k views

texdiff for multi-file documents in subversion

I've been looking for a convenient way to highlight changes between subversion revisions of my Latex document in the generated PDF. I am working on a reasonably complex document that pulls together ...
18
votes
4answers
1k views

How to create a PDF presentation for each available Beamer theme automatically?

Rather than changing the theme by hand and compiling it for each available theme, is there an easier way to do so such that I can get a PDF presentation for each available theme automatically?
17
votes
6answers
3k views

Automatically replace all |foo| with \abs{foo}

Technically speaking, this isn't a LaTeX specific question, but there are so many useful tools in LaTeX, and I'm using it to solve a LaTeX problem, so I thought here would be a good place to ask. I ...
17
votes
2answers
4k views

Write18: capturing shell (script) output as command/variable?

Let's say I compile the following file with pdflatex -shell-escape test.tex: \documentclass{minimal} \begin{document} File listing is: \immediate\write18{ls /usr} \end{document} This will send ...
15
votes
3answers
983 views

Automatic document update

As many of you I do quite a bit of teaching to make living. The worst part of the semester is usually beginning when I create and upload course Syllabi as well as the end of the semester when I ...
15
votes
2answers
141 views

How do extra braces impact the placement of items in the document?

I am placing some of my document through some outside BASH scripts, but want to protect some information such that the scripts will not change them. The simplest option for me is to put { and } around ...
15
votes
3answers
297 views

Automated removal of unneeded packages

As others certainly do, I generally use a template for my papers, which contains everything I usually need (packages, macros, ...) to typeset my documents. However, my needs sometimes vary, and in the ...
14
votes
2answers
726 views

Use \addbibresource via a script

Is there some way to use \addbibresource with biblatex to fetch a remote bibliography (in my case from CiteULike), but piping it through a script first? The output from CiteULike isn't perfect for ...
14
votes
1answer
545 views

Testing Framework API for LaTeX

As part of an online exam application, we need to automate the evaluation of LaTeX scripts written by the students. Essentially, the script should be evaluated against a set of test cases and if it ...
11
votes
4answers
1k views

Does LaTeX have a built-in scripting language?

Say I want to draw a simple graph in LaTeX. I'm interested to know if you can write a for loop or something to create things like lines or squares programmatically in LaTeX.
11
votes
6answers
3k views

Generate LaTeX Truth Table with Python Cheetah

While looking for code which can automatically generate truth table in LaTeX I stumbled on this Python generator. It appears that the code can be used from Cheetah's framework. Can anybody point me to ...
11
votes
4answers
481 views

Autocompile LaTeX doc when updated in Windows (via dropbox, in this case)

Goal: I'd like to be able to have a script running on my Windows computer that autogenerates the PDF of my LaTeX doc whenever the main .tex doc gets updated. Use case is I am editing the .tex file ...
10
votes
3answers
1k views

Most efficient method to strip all of the LaTeX code from a document?

Can some people please give me some suggestions for the most efficient method to strip all of the LaTeX code from a document? The best method that comes to my mind, which I have no clue about how to ...
10
votes
2answers
255 views

replace often used Tex-Literals ($ and $$) for math regions into \( or \) and \[ or \]

Is there an editor or IDE (or a script) for substituting the TeX-Commands $ and $$ for opening and closing math regions into the corresponding LaTeX-Commands \(,\) and \[,\]? I'm sure there is a tool ...
10
votes
2answers
1k views

Is there a tool/script available to simply install packages locally?

This question is not on how to manually install packages but how to install packages automatically via script. This question is not about MikTeX or the limited tex package management in certain linux ...
10
votes
1answer
3k views

MiKTeX and Perl scripts (and one Python script)

Again and again here on TeX.SX users of MiKTeX ask a question having a problem with a package or included program, where it turns out, that a Perl script is involved, in particular glossaries (because ...
10
votes
3answers
339 views

How to replace all $ $ by \( \)?

I want to replace all TeXish math $ $ in a tex file by LaTeXish \( \) and also $$ $$ by \[ \]. How can I do this cleverly? Please beware that in TikZ environment, one can not replace $ $ by \( \).
9
votes
3answers
627 views

How do I make a script to make inkscape TikZ more human readable

When I export a svg file from inkscape to TikZ, the result is often huge, and not very human readable. I would like to write a perl script for post processing the output. The script should be able to: ...
9
votes
1answer
3k views

all-in-one-engine for TeXShop

I am trying to write my 'Matura work' for school in LaTeX. Therefore I am using MacTeX and TeXShop and normally it works fine. But I am really annoyed with running all these different engines like ...
9
votes
1answer
249 views

Make a “standalone” version of multiple files: all document in one .tex file

Disclaimer: this question is not related to the standalone package. When writing an article, I split the content between several files, to ease the versionning notably. At the time of writing, most ...
8
votes
2answers
1k views

How can I update TikZ/PGF?

I am searching a script that will do the following. Removing all old PGF/TikZ files in my local texmf tree Installation of all new PGF/TikZ in my local texmf tree of the csv repository: PGF and TikZ ...
8
votes
2answers
3k views

Exit codes of pdfLaTeX

In the script I presented in this question I encountered the following problem. In case of a compilation error, I have to cancel the execution of pdflatex 3 times. This can be very annoying. I would ...
8
votes
2answers
1k views

Compiling latex directly from R

I want to find a programmatic way of converting a .tex latex document to pdf. What I usually do, and this works in most cases, is to use: tools::texi2dvi(latexfile, pdf = TRUE, clean = TRUE) ...
7
votes
4answers
3k views

pdflatex bash script to supress all output except error messages?

I have a bash script which I use to compile a file with pdflatex twice (to make sure it sorts out references properly, etc.). This is the 'latexbuild' script I use: module load ctan pdflatex ...
7
votes
1answer
2k views

Search & Replace Script for TeXworks

Does anyone have an example for a search & replace lua script that I can use with TeXworks. I have a rather large document here (about 3'000 pages DIN A5) which I need to update continously. To ...
7
votes
1answer
90 views

How to pass argument to an external script?

I want to pass some argument to an external script. I try : \immediate\write18{./script \a\ \b\ \c > output.tex} It works, but \a \b and \c are not given as three different arguments, but as ...
6
votes
2answers
1k views

Filter .bib file for items that are actually used with \cite? [duplicate]

Possible Duplicate: How to split all BibTeX referenced entries from a big BibTeX database to a copy? I have one big foo.bib file that contains all my references. Every one of my different ...
6
votes
2answers
105 views

Nicely recover embedded images

I have the latex source code and final generated PDF, but not the image files. I'd like to modify the document, so I'd like to recover the image file so that I can recompile. I can (very slowly) ...
6
votes
1answer
225 views

What is the state of support for (Unicode) Indic scripts in Context?

I have used XeTeX for typesetting a book using Unicode Malayalam. It is working perfectly and the production is fine. Reading about ConteXt, I learn it is more suitable and flexible for book ...
5
votes
3answers
1k views

How to make the rmligs script available globally on Windows?

Hopefully on-topic as about "(La)TeX related software and tools" I just learned about the rmligs script. Since it isn't available through MiKTeX (and neither through TeX Live), I downloaded the ...
5
votes
1answer
2k views

Run a shell script from a PDF generated by LaTeX

I have a shell script (which should open some program/file) which I want to invoke by clicking on a link in the generated .pdf file (in my case a beamer presentation). I tried including: ...
5
votes
2answers
2k views

External scripts when using TeXShop

As I wrote in this answer to my question, I decided to use a shell script in order to concatenate the bunch of .tex files and compile them. However, this way, when ever I want to compile the whole ...
5
votes
1answer
495 views

pdftex and interaction=batchmode and xwatermark

I try to compile this file: \documentclass[10pt,openany,titlepage]{book}% \usepackage{lipsum}% \usepackage{xcolor}% \usepackage[printwatermark,default-first-page=10]{xwatermark}% ...
5
votes
2answers
91 views

Is there any way to know what equation number will be?

Suppose I am writing a LaTeX document describing some code and in the code I would like to refer to specific equation numbers in the document. Is there an automatic way to determine what equation ...
5
votes
1answer
190 views

Splitting a huge `.tex` file to chapter files on TeX/LaTeX level [closed]

Inspired by (although a possible duplicate) Outputting each chapter of a LaTeX document to a separate PDF, I wonder whether there is a possibility to extract the chapter (or whatever sectioning level) ...
5
votes
2answers
2k views

error “latexdiff: The Perl Script could not be found.” [duplicate]

I have MikTeX 2.9 installation and Strawberry Perl 5.10.1.5. All the latexdiff, latexdiff-fast, latexidff-so paths seem to be present in the scripts.ini file and their .exe files in the ...
4
votes
1answer
129 views

How to batch generate badges with a list of names?

I want to make a number of badges using LaTeX for the participants of a summer school. There are 40 or so people, so I don't want to manually change the name and compile and then print. I could think ...
4
votes
2answers
2k views

Unable to use python.sty package

When compiling a .tex file that uses python.sty package and contains: \begin{python} ... \end{python} I keep getting an error: ./main.tex:33:I can't find file 'bin/main.py.out' \end{python} ...
4
votes
2answers
143 views

TeXstudio: Can a script read its trigger?

I would like to write a macro with a trigger #[a-z] that, dependent on the character in the trigger, writes the corresponding Greek letter. That is, the trigger #a should produce \alpha, the trigger ...
4
votes
2answers
3k views

OS X command-script to compile LaTeX

I'm trying to create a script that compiles LaTeX on OS X. Unfortunately I'm not familiar with the language and even though the code works, it has several flaws. Is it possible to close the terminal ...
4
votes
1answer
731 views

LaTeX compilation failure on Mac OS X from Python Script

I wrote a Python script to automate some LaTeX builds. Currently I develop/test on Mac OS X (did not try it on other UNIX flavors). The particular execution function which should compile the LaTeX ...
4
votes
1answer
125 views

Triple scripts for analysis

I am doing the music harmonic analysis. There are plenty of symbols that must be added and there are need for: underscript triple sub/super scripts:
4
votes
2answers
348 views

Generate list of all installed (La)TeX files

I'm trying to write a script (Perl) for the general public which would need to have a list of all installed TeX files of a certain type, e.g. .sty and/or .cls files or only plainTeX files (.tex), ...
3
votes
1answer
576 views

Possible to have a shell script containing the whole LaTeX document?

I've seen some examples where shell scripts are incorporated into LaTeX documents. However, I haven't seen any example of an entire LaTeX document being incorporated into a shell script. Does anyone ...
3
votes
2answers
720 views

Sublime Text Snippets just for LaTeX

If I want to write a few new Key Bindings for Sublime Text which should only work in LaTeX files (like typing _ or ^ after another character adds the surrounding curly brackets automatically) what do ...
3
votes
3answers
86 views

How to clean unused files?

I recently edited an existing document to create a new one from it (that is: I copied the whole folder to a new location and started from there). The early document had a lot of figures, but not all ...