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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fig2latex-0.0.1.tar.gz
.
File metadata
- Download URL: fig2latex-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00e547947ab321512e19dea1118954ad892338510478cca278b8df5725cf8d14 |
|
MD5 | d08abc2a7aafcb63d8ab62506438c4a4 |
|
BLAKE2b-256 | 0fd1a472c158ba489180c378137e90aedd9925d87ef9591794caaf509b37cf5a |
File details
Details for the file fig2latex-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: fig2latex-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b62570df097263c9b5d6859d385cbe9afe00be91d0bd5ad2130e193d9082c22a |
|
MD5 | fdb5c6a10426b8955b3cf208f200df2d |
|
BLAKE2b-256 | 141c43ee3bdcba1616939d0f02aaebf96ea8f27b3e917fdd035581312786d9db |