Class Caption
java.lang.Object
uk.ac.starlink.ttools.plot2.Caption
Content of textual item to be rendered somewhere on a plot.
It currently contains the text and LaTeX representation.
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.
- Since:
- 10 Mar 2020
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConcatenates another caption following this one.static CaptioncreateCaption(String txt) Constructs a caption for which the LaTeX representation is the same as the plain text representation.static CaptioncreateCaption(String txt, String latex) Constructs a caption for which the LaTeX representation is supplied explicitly.static CaptioncreateCaption(String txt, UnaryOperator<String> toLatexFunc) Constructs a caption for which the LaTeX representation will be generated lazily from the plain text.booleaninthashCode()abstract StringtoLatex()Returns the LaTeX representation of the caption.toText()Returns the plain text representation of the caption.
-
Constructor Details
-
Caption
-
-
Method Details
-
toText
Returns the plain text representation of the caption.- Returns:
- plain text content
-
toLatex
Returns the LaTeX representation of the caption.- Returns:
- latex content
-
append
-
hashCode
-
equals
-
createCaption
Constructs a caption for which the LaTeX representation is the same as the plain text representation. Currently not quoting is performed, so it is the responsibility of the caller to ensure that the plain text does not contain any LaTeX markup.- Parameters:
txt- caption content (plain text and latex)- Returns:
- new caption
-
createCaption
-
createCaption
Constructs a caption for which the LaTeX representation will be generated lazily from the plain text.- Parameters:
txt- plain text captiontoLatexFunc- function that maps plain text to latex- Returns:
- new caption
-