LatexGenerator¶
This module contains a class to generate LaTeX content based on the provided sentences.
Classes¶
- class chemdatawriter.latex_generator.LatexGenerator¶
A generator to produce LaTeX content based on provided sentences.
- __init__()¶
Initialize the LatexGenerator instance.
- generate_intros(sents, threshold=0.9)¶
Generate introductory sentences ensuring minimal similarity between them.
- Parameters:
sents (list of str) – List of sentences.
threshold (float) – The similarity threshold, beyond which sentences are considered similar (default is 0.9).
- Returns:
List of introductory sentences.
- Return type:
list of str
- latex_escape(text)¶
Escape LaTeX special characters.
- Parameters:
text (str) – Text containing special characters.
- Returns:
Text with special characters escaped for LaTeX.
- Return type:
str
- generate_body(sents, titles)¶
Generate the body of the LaTeX document.
- Parameters:
sents (list of str) – List of sentences.
titles (list of str) – List of titles corresponding to the sentences.
- Returns:
Body of the LaTeX document.
- Return type:
str
- generate_references(sents)¶
Generate the references section of the LaTeX document.
- Parameters:
sents (list of str) – List of sentences.
- Returns:
References section of the LaTeX document.
- Return type:
str