Skip to main content

fig2latex is a Python utility for converting figures to LaTeX format. This utility simplifies the process of including figures in LaTeX documents by generating the necessary LaTeX code.

Project description

fig2latex

Introduction

fig2latex is a Python utility for converting figures to LaTeX format. This utility simplifies the process of including figures in LaTeX documents by generating the necessary LaTeX code.

Installation

You can install fig2latex via pip: pip install fig2latex

Usage

from pathlib import Path
from fig2latex import fig2latex

# Example usage:
figure_path = Path("example.png")
label = "fig:example"
caption = "Example Figure"
latex_code = fig2latex(figure_path, label=label, caption=caption)
print(latex_code)

Convert a figure to LaTeX format.

  • Parameters:

    • figure_path (Path): Path to the figure file.
    • label (str, optional): Label for the figure.
    • caption (str, optional): Caption for the figure.
    • centered (bool, optional): Whether to center the figure. Default is True.
    • text_width (float, optional): Width of the figure as a fraction of text width.
    • placement (str, optional): LaTeX placement specifier for the figure.
  • Returns:

    • str: LaTeX representation of the figure.
  • Example:

    fig2latex(Path("example.png"), label="fig:example", caption="Example Figure")
    

    Output:

    \begin{figure}
    \includegraphics{example.png}
    \caption{Example Figure}
    \label{fig:example}
    \end{figure}
    

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fig2latex-0.0.1.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

fig2latex-0.0.1-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page