@Equality public abstract class Caption extends Object
Concrete subclasses must supply the LaTeX representation;
a number of createCaption
factory methods are provided
to facilitate this.
Caption equality is assessed on the basis of the primary text value only, not the LaTeX value. In practice, this is likely to be the relevant criterion.
Modifier | Constructor and Description |
---|---|
protected |
Caption(String txt)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Caption |
append(Caption other)
Concatenates another caption following this one.
|
static Caption |
createCaption(String txt)
Constructs a caption for which the LaTeX representation is the
same as the plain text representation.
|
static Caption |
createCaption(String txt,
String latex)
Constructs a caption for which the LaTeX representation is supplied
explicitly.
|
static Caption |
createCaption(String txt,
java.util.function.UnaryOperator<String> toLatexFunc)
Constructs a caption for which the LaTeX representation will be
generated lazily from the plain text.
|
boolean |
equals(Object o) |
int |
hashCode() |
abstract String |
toLatex()
Returns the LaTeX representation of the caption.
|
String |
toText()
Returns the plain text representation of the caption.
|
protected Caption(String txt)
txt
- plain text caption contentpublic String toText()
public abstract String toLatex()
public Caption append(Caption other)
other
- second captionother
public static Caption createCaption(String txt)
txt
- caption content (plain text and latex)public static Caption createCaption(String txt, String latex)
txt
- plain text representationlatex
- LaTeX representationpublic static Caption createCaption(String txt, java.util.function.UnaryOperator<String> toLatexFunc)
txt
- plain text captiontoLatexFunc
- function that maps plain text to latexCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.