Questions tagged [scripts]
{scripts} is for questions involving external scripts (small programs in source code form) related to (La)TeX.
195
questions
7
votes
6
answers
6k
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 ...
1
vote
0
answers
232
views
Randomly generate pdf on website [closed]
I have created a latex file which creates a pdf by randomly selecting 10 subfiles from a pool of files. This works fine, and I am able to generate a random PDF every time I run my script. A breakdown ...
1
vote
0
answers
62
views
How to write an Script for TexStudio to auto switch into English language inside of math mode?
Switching from local keyboard language to English then backing to local keyboard language outside of math mode is common in non-English latex users.
How to write an Script for TexStudio to auto ...
1
vote
1
answer
608
views
How do you copy all the images referenced in a document into a single directory? [duplicate]
I am finalising a book and I need to submit all the images as separated files along with the manuscript.
Now, images are all saved in different places and referenced with a relative path from my ...
0
votes
1
answer
46
views
Post build processes with shell script and write18
I would like to start a shell script from LaTeX. In the shell script I need to wait until the .pdf file is generated and afterwards I want to do some stuff with this file.
So I created a MWE Test.tex ...
26
votes
4
answers
14k
views
pdflatex bash script to supress all output except error messages? [duplicate]
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 --shell-...
0
votes
0
answers
44
views
Is it possible to automatically run a shell script within Overleaf?
I am working on a paper which requires a split bibliography, with a section after the main text, and a section following the supplementary materials. No reference needs to be included in both sections....
13
votes
2
answers
9k
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 ...
0
votes
0
answers
54
views
Implement a word blacklist in latex
I'm working on a colaborative project where we're trying to align around terminology.
We have a list of 'banned phrases' that some authors use coloquially, but that we want to make sure we don't use ...
12
votes
2
answers
9k
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 ...
0
votes
0
answers
22
views
Get page numbers of colored pages [duplicate]
I am writing a book in LaTeX that is mostly black and white, however a really small portion of the pages contain colored images.
I would like a way to automatically print, at the end of my text, the ...
0
votes
0
answers
18
views
Use `sed` in a Latex-Workshop Recipe to replace special characters
I'm using sed -i 's/[_&$]/\\&/g; s/\\\\/\\/g' *.bib to make use no & or _ remain before comppiling. I'd like to do this automatically before running latexmk recepie in latex workshop.
...
416
votes
28
answers
444k
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 ...
1
vote
0
answers
60
views
Is It Possible to Match This Handwritten Brooklyn Font with LaTeX?
I would like to match, if possible, the following handwritten font:
I was hoping that Latex offers it, but I could not locate it.
QUESTION: Is this particular font available with Latex; perhaps via a ...
0
votes
0
answers
62
views
Latexmk execute script to build dependencies
for my thesis i need the results of some external scripts to be integrated in my document.
It should look like this:
latexmk -pdf
=> external script starts
wait until script is finished
do the ...
4
votes
1
answer
151
views
Understanding implicit error on a recursive function
I was originally following the idea from Garrick Peschke
To import all .tex files inside a folder, but I want my Lua function to also search inside subfolders.
Unfortunately I can't make the Lua ...
0
votes
0
answers
65
views
How to make fancy-preview work?
I use the fancy-preview script but I don't get the desired result (error while compiling).
Perl 5 and Config::IniFiles module are well installed :
As well as the two AcroTeX packages :
fancytooltips ...
3
votes
1
answer
113
views
TexWorks JavaScript to convert into SI-units
I try to write a script for the TexWorks editor.
I want to be able to convert easy writeable physical units into the syntax of the SI-Unit latex package.
For example:
I write: 12,45A
mark it and hit ...
0
votes
1
answer
121
views
Detect draft mode from Lua in LuaLaTex
I'm working with a document for which I need to generate some data from a Lua script each time the PDF is produced. However, the generation of this data might be a slow, so I would like the script ...
1
vote
0
answers
102
views
Is it possible to run a script in e.g. Python in a LaTeX .cls?
For a package I'm writing, it would be very handy to use some programmed scripts, for example written in Python. Is there a way how I could add these to my .cls file?
And if not, what is the usual way ...
1
vote
1
answer
1k
views
Exporting graphs from Mathematica to LaTex document?
Matlab has Matlab2Tikz while open for Mathematica2Tikz, more here. How can I export graphs such as Harary graphs from Mathematica to LaTex?
Example graph generated in Mathematica without finding ...
1
vote
0
answers
286
views
VS Code - LaTeX-Workshop - Recipe with `for` script
Hello There
Currently creating compilation recipes for LaTeX-Workshop extension in visual studio code, how to create a tool that rename files using for and mv or some other method?
The script using a ...
2
votes
1
answer
230
views
getnonfreefonts Certificate error
My question has been asked before, but the answer does not work for me: TeXLive getnonfreefonts-sys error: untrusted certificate from tug.org
The script getnonfreefonts is unable to install the fonts ...
0
votes
1
answer
525
views
Script {} in latex
So I'm writing my master thesis and I was wondering whether there was a way to script a custom \Laplace function in Latex. I want to write \Laplace(input) and get the output \Laplace \{ input \} as my ...
0
votes
1
answer
97
views
How to prevent script (via \immediate\write18) from running multiple times?
How to prevent the execution of script (via \immediate\write18) multiple times when running latexmk (which calls pdftex multiple times)? The problem is that during each iteration of pdftex, the script ...
12
votes
3
answers
2k
views
Automatically validate and format ISBNs
Is there any way to get Biblatex to automatically validate and format ISBNs? That is, I would like to be able to enter a field such as
isbn = {9789549090666},
in my .bib file—not worrying about the ...
0
votes
0
answers
150
views
How to run TeX4ht and or tex4ebook
I have found that I can use tex4ebook to convert my Latex document into Epub3 but I haven't found anywhere where it states what program should be used to run the script (I normally write Latex in ...
4
votes
1
answer
332
views
Programmatically editing Synctex files?
I'm in a situation where I'm building my LaTeX with a script that preprocesses my .Tex files, producing new ones as output that are then compiled with latexmk.
Ideally, the synctex files will point ...
37
votes
4
answers
12k
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 ...
6
votes
2
answers
232
views
Script for dualizing diagrams in tikzcd by mirroring
My question is very similar to this one, but in some cases I would prefer my diagrams to be mirrored instead of rotated. Is it possible to write a script which achieves this in LaTeX? As an example I ...
2
votes
1
answer
2k
views
How do I automatically fill LaTeX templates with from a table of data?
I have a LaTeX template like
\documentclass[12pt]{article}
\begin{document}
Hello, \VAR{USER}!
\end{document}
and a table of users (for example as a csv) like
ID,USER
01,Peter
02,Michael
03,Jana
...
...
0
votes
0
answers
553
views
Compiling .tex file and generating pdf using a bash script in Windows
I am trying to compile & generate pdf from a .tex file using a bash script to automate the process. I need to use bash script as there are a large number of .tex files to be handled.
I am using ...
1
vote
1
answer
214
views
Change settings with macros TeXstudio
I'd like to have a macro in my TeXstudio to change settings, more specifically PdfLaTeX command from
pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex
to
pdflatex.exe -synctex=0 -interaction=...
1
vote
1
answer
66
views
expand \today in english rather than hindi
\documentclass{article}
\usepackage{polyglossia}
\usepackage[Latin,Devanagari]{ucharclasses}
\setmainfont{Mangal}
\newfontfamily{\devanagarifont}{Mangal}
\newfontfamily{\...
5
votes
1
answer
272
views
TeXstudio; 'could not start the command' for custom command running bash script
Edit: solved.
Solution: RTFM.
I.e. as Schoekling suggested, the manual states:
"Each user command has a name with a pattern :, e.g. user0:User Command 0. The command id has to be unique and must ...
0
votes
2
answers
209
views
Tool for adding index automatically to tex's files from a list
Is there any dedicated tool (script or LaTeX's package) for adding the \index command (or other command) to many LaTeX's files?
The idea is to declare the list of the requested index such
Henri ...
18
votes
6
answers
2k
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 -...
3
votes
1
answer
869
views
Organiser Refills/Inlays using LaTeX
Every year I need to refill my beloved organiser. But the refills on simple A5 paper are sold for incredible prices around $20.
Is there a way to create organiser inlays using LaTeX (e.g. one week ...
0
votes
0
answers
76
views
How do I get consistent margins in dramatist?
The code:
\documentclass[a5paper,11pt]{memoir}
\usepackage{dramatist,etoolbox,enumitem}
\usepackage[latin]{babel}
\pagestyle{empty}
\makeatletter
\renewenvironment{drama}
{\if@lnpa
\...
89
votes
5
answers
33k
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 ...
2
votes
1
answer
40
views
Is there a script/macro which includes figures, having 3 arguments: 1) input file, 2) caption and 3) scale?
I'm looking for a macro like,
\newcommand{\figu}[3]{
\begin{figure}[H]
\scalebox{#3}
{\begin{center}
{\includegraphics[width=13 cm, height=8 cm]{#1}}
\end{center}}
\vspace{-0.2cm}
\caption{\hspace{0....
15
votes
5
answers
3k
views
Can LaTeX automatically itemize a list?
So I have a word list file in .txt format,
I want to edit it and enumerate them. But since the file runs into thousands of lines potentially, it would be a daunting task to do it manually. I wonder ...
2
votes
2
answers
2k
views
Removing all markup automatically changes package [closed]
I have looked around and found no answer to this question.
I am using the changes package, and I need to remove all markup from the source file. There's this question about using the delcmdchanges....
1
vote
0
answers
39
views
Create a command to reduce code duplication when inserting imgage
so I have to do a pdf with a lot of images and I would like to avoid code duplication, so I'd like to create something like a function which take as input two arguments:
Image name
Caption text
So ...
13
votes
4
answers
8k
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 ...
0
votes
0
answers
90
views
LuaLatex , how put glyph freely
Lua are incredible engine. I have a font in ttf and I would put a specific glyph in a specific place.
For example I create a logo.
I need to put second version of 'a' in (x,y)=(12pt,30pt) from left ...
0
votes
1
answer
95
views
TeXstudio scripts – internal viewer
I need to make a macro script that would "press" Fit to Width button in the TeXstudio's internal viewer.
I found that viewer object is called pdfs[0], but, unfortunately, on the wiki page there are ...
1
vote
0
answers
32
views
Matlab's script losing identation when pdf is generated. How can i solve it?
i am new in all this Latex stuff, but i am trying to learn.
Currently i am stuck in a problem: display a Matlab code.
This is my code in TexStudio:
\documentclass[12pt]{article}
\usepackage[margin =...
2
votes
1
answer
219
views
I want to write a script that replaces all $$ ... $$ math formulas with \ [... \] in texstudio
Ask people to help me write a script that replaces all the math formulas $$ ... $$ into \ [... ] in texstudio.
Thank you!
0
votes
0
answers
59
views
Dynamically move and edit text?
I've created a LaTeX document to track my goals and weekly/daily to-do's. I have labels for the goals and weekly tasks that I reference in the daily tasks. Here is what I am hoping to automate with ...