Skip to main content

TeX Untag

A script for removing all of a given markup tag from a set of TeX files.

Description

This is a small script for removing markup tags of the form \tag{...} from a TeX file or set of TeX files. It can be imported using

import tex_untag

The user can specify the exact tag name string that they want removed, and all instances within the specified file or files will be removed. For example, executing the function

untag_file("report.tex", "textit")

would remove all italic text tags of the form \textit{...} from the document report.tex, while

untag_file("report.tex", "textcolor{red}")

would remove all red text tags of the form \textcolor{red}{...}. Comments are (optionally) ignored during this process.

Note that, since this process involves overwriting existing files, it is recommended that you back up your data before attempting to use it.

Functions

This module defines two main public functions:

  • tex_untag.untag_file(fname, tag[, comment]): Removes the given tag from a single file or a list of files called fname. The optional comment boolean specifies whether to remove tags from comments (default False). Returns the total number of tag removals made.
  • tex_untag.untag_folder(folder, tag[, ext][, comment]): Removes the given tag recursively from every file within the given folder and its subfolders. The optional ext argument is a string or list of strings specifying which file extensions to include (default tex), while the optional comment boolean specifies whether to remove tags from comments (default False). Returns the total number of tag removals made and the total number of files processed.

Command Line Usage

This package defines a console script tex-untag which can be used as follows:

usage: tex-untag [-h] [-v] [-f [FILES ...]] -t TAG [-e [EXTENSIONS ...]] [-q] [-r] [-c]

A script for removing markup tags from a set of TeX files.

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -f [FILES ...], --file [FILES ...]
                        file, list of files, or directory to process (if blank and
                        --recursive, uses current working directory)
  -t TAG, --tag TAG     tag to remove from files
  -e [EXTENSIONS ...], --extension [EXTENSIONS ...]
                        file extensions to process (default only tex)
  -q, --quiet           silence result message
  -r, --recursive       recursively process all files in the given directory
  -c, --comments        removes tags even in comments

This script removes a given TeX markup tag from a given file or set of files. The tag is
assumed to use the form "\tag{...}". The given tag should include the full text that falls
between the '\' and '{' characters.

The file (-f) argument can include a single file, a list of files, or a directory, in which
case the recursive (-r) flag should be used.

The extension (-e) argument is optional, and if absent only 'tex' files will be processed.
Otherwise it can include either a list of file extensions or the '*' character, in which
case all files will be included.

For example,

$ tex-untag -f introduction.tex results.tex conclusion.tex -t textit -c

would remove all italic \textit{...} tags from the three local files introduction.tex, results.tex, and conclusion.tex, including those located inside comments, while

$ tex-untag -f report -t textcolor{red} -e tex bbl --recursive

would remove all red text \textcolor{red}{...} tags from every .tex or .bbl file within the local directory report/.

Metadata

Release files for tex-untag 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tex-untag 1.3.0
File Size Uploaded
tex-untag-1.3.0.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tex-untag 1.3.0
File Interpreter ABI Platform
tex_untag-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / tex-untag-1.3.0.tar.gz

Download URL tex-untag-1.3.0.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
466c6b91476dc6cdb537b34d3f9c8ca8b8f49b972a30e53ebfb11623794ef824
BLAKE2b-256 checksum
How to use checksums
0758b374f0a69a28403bf426a9812a9b3d84ebc31c600f9854e6ff38d9e00c59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / tex_untag-1.3.0-py3-none-any.whl

Download URL tex_untag-1.3.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2657ab10b136ac5cc042920f9da63da95da9389e8d9624b6c8161238b1554a49
BLAKE2b-256 checksum
How to use checksums
ecb608259352b303da7765656330ea7a8ffa41d408f07f5e36016c98fe070f78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

0.5.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page