Package uk.ac.starlink.table.formats
Class LatexTableWriter
java.lang.Object
uk.ac.starlink.table.formats.DocumentedStreamStarTableWriter
uk.ac.starlink.table.formats.LatexTableWriter
- All Implemented Interfaces:
Documented
,DocumentedIOHandler
,StarTableWriter
A StarTableWriter that outputs text to a LaTeX document.
Depending on the value of the
standalone
attribute,
the output may either be a complete LaTeX document or just a
tabular environment suitable for inserting into an existing
document.- Author:
- Mark Taylor (Starlnk)
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new writer with default characteristics.LatexTableWriter
(boolean standalone) Constructs a new writer indicating whether it will produce complete or partial LaTeX documents. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether the serialization of some (short) example table should be added to the user documentation for this handler.Returns the string "LaTeX-document" or "LaTeX";Returns a string suitable for use as the value of a MIME Content-Type header.static StarTableWriter[]
Returns a useful list of LatexTableWriters.Returns user-directed documentation in XML format.boolean
Indicates whether output tables will be complete LaTeX documents.protected void
printFooter
(OutputStream ostrm, StarTable startab) For standalone output, this method is invoked to output any text following thetabular
environment.protected void
printHeader
(OutputStream ostrm, StarTable startab) For standalone output, this method is invoked to output any text preceding thetabular
environment.void
setStandalone
(boolean standalone) Sets whether output tables should be complete LaTeX documents.void
writeStarTable
(StarTable startab, OutputStream ostrm) Writes a StarTable object to a given output stream.Methods inherited from class uk.ac.starlink.table.formats.DocumentedStreamStarTableWriter
getExtensions, looksLikeFile, writeStarTable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface uk.ac.starlink.table.formats.DocumentedIOHandler
readText
-
Constructor Details
-
LatexTableWriter
public LatexTableWriter()Constructs a new writer with default characteristics. -
LatexTableWriter
public LatexTableWriter(boolean standalone) Constructs a new writer indicating whether it will produce complete or partial LaTeX documents.
-
-
Method Details
-
setStandalone
@ConfigMethod(property="standalone", doc="<p>If true, the output is a freestanding LaTeX document consisting of a <code>tabular</code> environment within a <code>table</code> within a <code>document</code>. If false, the output is just a <code>tabular</code> environment.</p>") public void setStandalone(boolean standalone) Sets whether output tables should be complete LaTeX documents.- Parameters:
standalone
- true if the output document should be a complete LaTeX document
-
isStandalone
public boolean isStandalone()Indicates whether output tables will be complete LaTeX documents.- Returns:
- true if the output documents will be complete LaTeX docs
-
getFormatName
Returns the string "LaTeX-document" or "LaTeX";- Returns:
- a short string identifying the output format of this writer
-
getMimeType
Description copied from interface:StarTableWriter
Returns a string suitable for use as the value of a MIME Content-Type header. If no suitable MIME type is available or known, one of "application/octet-stream
" (for binary formats) or "text/plain
" for ASCII ones) is recommended.- Returns:
- MIME content type
-
docIncludesExample
public boolean docIncludesExample()Description copied from interface:DocumentedIOHandler
Indicates whether the serialization of some (short) example table should be added to the user documentation for this handler. Binary formats, or instances for which theDocumented.getXmlDescription()
method already includes some example output, should return false.- Returns:
- true if the user documentation would benefit from the addition of an example serialization
-
getXmlDescription
Description copied from interface:Documented
Returns user-directed documentation in XML format.The output should be a sequence of one or more <P> elements, using XHTML-like XML. Since rendering may be done in a number of contexts however, use of the full range of XHTML elements is discouraged. Where possible, the content should stick to simple markup such as the elements P, A, UL, OL, LI, DL, DT, DD EM, STRONG, I, B, CODE, TT, PRE.
- Returns:
- XML description of this object
-
writeStarTable
Description copied from interface:StarTableWriter
Writes a StarTable object to a given output stream. The implementation can assume that out is suitable for direct writing (for instance it should not normally wrap it in aBufferedOutputStream
), and should not close it at the end of the call.Not all table writers are capable of writing to a stream; an implementation may throw a
TableFormatException
to indicate that it cannot do so.- Parameters:
startab
- the table to writeostrm
- the output stream to which startab should be written- Throws:
IOException
- if there is some I/O error
-
getStarTableWriters
Returns a useful list of LatexTableWriters.- Returns:
- array containing one standalone and one tabular-only writer
-
printHeader
For standalone output, this method is invoked to output any text preceding thetabular
environment. May be overridden to modify the form of output documents.- Parameters:
ostrm
- output streamstartab
- table for which header is required- Throws:
IOException
-