How To Install ptex2tex on Ubuntu 18.04

In this tutorial we learn how to install ptex2tex on Ubuntu 18.04. ptex2tex is easy generation of (possibly complex) LaTeX environments

Introduction

In this tutorial we learn how to install ptex2tex on Ubuntu 18.04.

What is ptex2tex

ptex2tex is:

Ptex2tex is a tool that allows you to replace LaTeX environment declarations with simple keywords. In a way, Ptex2tex allows you to create LaTeX packages without any sophisticated knowledge on how to write LaTeX packages. The idea behind Ptex2tex is code generation: instead of hiding complicated LaTeX constructions in complex LaTeX packages, one simply generates the necessary LaTeX commands on the fly, from a compact begin-end environment indication in the LaTeX source. This implies that you have to preprocess your LaTeX source to make an ordinary LaTeX file that can be compiled in the usual way.

The main application of Ptex2tex is for inserting verbatim-style computer code in LaTeX documents. Code can be copied directly from the source files of the software (complete files or just snippets), and output from programs can be created and copied into the documentation as a part of running Ptex2tex. This guarantees that your LaTeX document contains the most recent version of the program code and its output!

With the default Ptex2tex configuration style, you can switch between 30+ styles for computer code within seconds and just recompile your LaTeX files. Even in a several-hundred pages book it takes seconds to consistently change various styles for computer code, terminal sessions, output from programs, etc. This means that you never have to worry about choosing a proper style for computer/verbatim code in your LaTeX document. Just use Ptex2tex and leave the decision to the future. It takes seconds to change your mind anyway.

There are three methods to install ptex2tex on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install ptex2tex Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install ptex2tex using apt-get by running the following command:

sudo apt-get -y install ptex2tex

Install ptex2tex Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install ptex2tex using apt by running the following command:

sudo apt -y install ptex2tex

Install ptex2tex Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install ptex2tex using aptitude by running the following command:

sudo aptitude -y install ptex2tex

How To Uninstall ptex2tex on Ubuntu 18.04

To uninstall only the ptex2tex package we can use the following command:

sudo apt-get remove ptex2tex

Uninstall ptex2tex And Its Dependencies

To uninstall ptex2tex and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove ptex2tex

Remove ptex2tex Configurations and Data

To remove ptex2tex configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge ptex2tex

Remove ptex2tex configuration, data, and all of its dependencies

We can use the following command to remove ptex2tex configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge ptex2tex

References

Summary

In this tutorial we learn how to install ptex2tex package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.