GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - vsoftco/cpptexnumber: C++11 program for renumbering LaTeX references

BranchesTags
Open more actions menu

Latest commit

 

History

27 Commits
27 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.clang-format
.clang-format
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
prettyprint.sh
prettyprint.sh
 
 

Repository files navigation

cpptexnumber

Renumbers LaTeX references.

Building without a build system

Compile with

c++ -std=c++11 -O3 src/cpptexnumber.cpp -o cpptexnumber

A CMakeLists.txt is provided for automatic building via CMake. The compiler must be C++11 compliant and must fully support the std::regex Regular Expression library of the C++ Standard Library. I recommend gcc version 4.9 or later, or clang version 3.5 or later.

Building with CMake

I recommend an out-of-source build, i.e., from the root of the project, execute

cmake -B build
cmake --build build

The above commands build the executable cpptexnumber inside the build directory.

Usage

The program reads from the standard input and writes to the standard output.

cpptexnumber <in.tex >out.tex pattern replacement [ignore_comments ON(default)/OFF] [log_file]

Description

Replaces all labels from the input stream (in this case redirected from in.tex) that match a given input pattern, such as \label{pattern*} and all corresponding references (\ref, \eqref, \pageref) with renumbered ones replacement+idx, where idx counts the matching \label{pattern*} order of appearance, i.e., equals 1 for the first \label that matches the input pattern, 2 for the second etc. The output is written to the standard output (in this case redirected to out.tex). Optionally, writes the replacement pattern sequence to log_file. Warnings and errors are output to the standard error stream.

Example

Consider a LaTeX file in.tex having three labels, named, in order of appearance, \label{eqn5}, \label{eqn_important}and lastly \label{entropy}. Then the command

cpptexnumber <in.tex >out.tex eqn Eqn ON log.txt

will replace \label{eqn5} by \label{Eqn1} (and also all references to eqn5 will automatically become references to Eqn1) and replace \label{eqn_important} by \label{Eqn2} (again together with the corresponding references), while ignoring any LaTeX comments. The \label{entropy} remains unchanged since it does not match the input pattern \label{eqn*}. The changes are saved to the file out.tex, and the replacement pattern sequence is written to the file log.txt.

About

C++11 program for renumbering LaTeX references

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.