How to use the command 'tectonic' (with examples)

How to use the command 'tectonic' (with examples)

Tectonic is a modern, self-contained TeX/LaTeX engine that offers a number of useful features for compiling and building TeX/LaTeX files. This article will guide you through several use cases of the ’tectonic’ command and provide examples for each.

Use case 1: Compile a standalone TeX/LaTeX file

Code:

tectonic -X compile path/to/file.tex

Motivation: Compiling a TeX/LaTeX file is necessary to generate the corresponding PDF output. The ’tectonic’ command, when used with the ‘compile’ option, allows you to compile a standalone TeX/LaTeX file easily.

Explanation:

  • ’tectonic’: The command itself.
  • ‘-X compile’: Specifies the compile option to indicate that we want to compile the file.
  • ‘path/to/file.tex’: The path to the TeX/LaTeX file you want to compile.

Example output:

Compilation successful. Output PDF generated: path/to/file.pdf

Use case 2: Compile a standalone TeX/LaTeX file with synctex data

Code:

tectonic -X compile --synctex path/to/file.tex

Motivation: Adding synctex data to a TeX/LaTeX file allows for efficient navigation between the source file and the corresponding PDF output. By using the ‘–synctex’ option, ’tectonic’ will generate synctex data along with the PDF output.

Explanation:

  • ’tectonic’: The command itself.
  • ‘-X compile’: Specifies the compile option to indicate that we want to compile the file.
  • ‘–synctex’: Enables the generation of synctex data.
  • ‘path/to/file.tex’: The path to the TeX/LaTeX file you want to compile.

Example output:

Compilation successful. Output PDF generated: path/to/file.pdf
Synctex data generated: path/to/file.synctex.gz

Use case 3: Initialize a tectonic project in the current directory

Code:

tectonic -X init

Motivation: Initializing a tectonic project in the current directory allows you to easily manage and build your TeX/LaTeX projects using ’tectonic’. It sets up the necessary configuration files and directory structure for a project.

Explanation:

  • ’tectonic’: The command itself.
  • ‘-X init’: Specifies the init option to initialize a tectonic project.

Example output:

Project initialized successfully.

Use case 4: Initialize a tectonic project in the specified directory

Code:

tectonic -X new project_name

Motivation: Using the ’new’ option allows you to create a new tectonic project in a specific directory. This is useful when you want to create a project in a location other than the current directory.

Explanation:

  • ’tectonic’: The command itself.
  • ‘-X new’: Specifies the new option to create a new tectonic project.
  • ‘project_name’: The name of the project and the directory in which it will be created.

Example output:

Project 'project_name' created successfully in: /path/to/project_name

Use case 5: Build the project in the current directory

Code:

tectonic -X build

Motivation: Building a tectonic project compiles all the TeX/LaTeX files within the project directory and creates the corresponding PDF outputs. It helps to ensure that all the files in your project are up-to-date and in sync.

Explanation:

  • ’tectonic’: The command itself.
  • ‘-X build’: Specifies the build option to build the project.

Example output:

Project built successfully. Output PDFs generated for all files in the project.

Use case 6: Start a watcher to build the project on change

Code:

tectonic -X watch

Motivation: Starting a watcher with ’tectonic’ allows you to automatically build the project whenever there are changes made to the TeX/LaTeX files. This provides a convenient way to continuously compile your project while you work on it.

Explanation:

  • ’tectonic’: The command itself.
  • ‘-X watch’: Specifies the watch option to start a watcher.

Example output:

Watcher started successfully. Project will be built on file changes.

Conclusion:

The ’tectonic’ command provides a modern and convenient way to compile, build, and manage TeX/LaTeX projects. By understanding and utilizing its various options, you can streamline your TeX/LaTeX workflow and achieve efficient document generation.

Related Posts

Using the appsleepd command (with examples)

Using the appsleepd command (with examples)

Starting the daemon To start the appsleepd daemon, simply run the command appsleepd.

Read More
How to use the command "doctl kubernetes options" (with examples)

How to use the command "doctl kubernetes options" (with examples)

The doctl kubernetes options command provides a way to retrieve information about available options for working with Kubernetes clusters in DigitalOcean.

Read More
Analyzing RPC Services with rpcinfo (with examples)

Analyzing RPC Services with rpcinfo (with examples)

Introduction The rpcinfo command is a handy utility that allows users to make Remote Procedure Call (RPC) calls to an RPC server and provides information about the available services.

Read More