Skip to content

Top LaTeX Commands

Walker Herring edited this page Apr 21, 2021 · 4 revisions

Implementation

This tool was created to find the most common latex commands in scholarly articles. These commands were prioritised for later development.

Design

This script will be given the path of a directory and the program will open and search all latex files one at a time. For each latex document, the program will search the contents looking for commands starting with a backslash (“\”) and will extract the command following the backslash until a space or another backslash is found. If this is the first instance of this command, we will place the command in a table and initialize its counter. If the command is already found its count will be incremented. After all the files have been run, the table of all found commands will be sorted from highest count to lowest count and will be written to a newly created text file titled “commandCount.txt”.

Issues and Refactoring

Latex files have some degree of ambiguity and the program does not recognize commands that are not in the most common form of “\[command]”. When the program encounters an unfamiliar command, it will add all known commands found thus far into the table and close the latex file at its current position and continue to the next file in the directory. We believe this execution does not compromise the integrity of the results.

Clone this wiki locally