Copyright | (c) 2015 Christopher Chalmers |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | c.chalmers@me.com |
Safe Haskell | None |
Language | Haskell2010 |
Functions for running and parsing using Tex's online interface. This is mostly used for getting measurements like hbox dimensions and textwidth.
Tex's online interface is basically running the command line. You can
see it by running pdflatex
without any arguments. The contents can
be writen line by and tex can give feedback though stdout, which gets
parsed in by this module. This is the only way I know to get info
like hbox sizes. Please let me know if you know a better way.
- data OnlineTex a
- runOnlineTex :: String -> [String] -> ByteString -> OnlineTex a -> IO a
- runOnlineTex' :: String -> [String] -> ByteString -> OnlineTex a -> IO (a, TexLog, Maybe ByteString)
- hbox :: Fractional n => ByteString -> OnlineTex (Box n)
- hsize :: Fractional n => OnlineTex n
- showthe :: Fractional n => ByteString -> OnlineTex n
- onlineTexParser :: Parser a -> OnlineTex a
- texPutStrLn :: ByteString -> OnlineTex ()
- type TexStreams = (OutputStream ByteString, InputStream ByteString)
- getInStream :: OnlineTex (InputStream ByteString)
- getOutStream :: OnlineTex (OutputStream ByteString)
- clearUnblocking :: OnlineTex ()
Documentation
Type for dealing with Tex's pipping interface, the current streams
are availble though the MonadReader
instance.
Running Tex online
:: String | tex command |
-> [String] | tex command arguments |
-> ByteString | preamble |
-> OnlineTex a | Online Tex to be Run |
-> IO a |
runOnlineTex' :: String -> [String] -> ByteString -> OnlineTex a -> IO (a, TexLog, Maybe ByteString) Source
Interaction
hbox :: Fractional n => ByteString -> OnlineTex (Box n) Source
Get the dimensions of a hbox.
hsize :: Fractional n => OnlineTex n Source
Dimensions from filling the current line.
showthe :: Fractional n => ByteString -> OnlineTex n Source
Parse result from showthe
.
onlineTexParser :: Parser a -> OnlineTex a Source
Run an Attoparsec parser on Tex's output.
texPutStrLn :: ByteString -> OnlineTex () Source
Low level
These functions allow give you direct access to the iostreams with tex. The implementation is likely to change in the future and using them directly is not recommended.
type TexStreams = (OutputStream ByteString, InputStream ByteString) Source
getInStream :: OnlineTex (InputStream ByteString) Source
Get the input stream to give text to tex.
getOutStream :: OnlineTex (OutputStream ByteString) Source
Get the output stream to read tex's output.
clearUnblocking :: OnlineTex () Source
Clear any output tex has already given.