Copyright | (c) 2015 Christopher Chalmers |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | c.chalmers@me.com |
Safe Haskell | Safe-Inferred |
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 written 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.
Synopsis
- 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 piping interface; the current streams
are available though the MonadReader
instance.
Instances
MonadIO OnlineTex Source # | |
Defined in System.Texrunner.Online | |
Applicative OnlineTex Source # | |
Functor OnlineTex Source # | |
Monad OnlineTex Source # | |
MonadReader TexStreams OnlineTex Source # | |
Defined in System.Texrunner.Online ask :: OnlineTex TexStreams # local :: (TexStreams -> TexStreams) -> OnlineTex a -> OnlineTex a # reader :: (TexStreams -> a) -> OnlineTex a # |
Running Tex online
:: String | tex command |
-> [String] | tex command arguments |
-> ByteString | preamble |
-> OnlineTex a | Online Tex to be Run |
-> IO a |
Run a tex process, discarding the resulting PDF.
runOnlineTex' :: String -> [String] -> ByteString -> OnlineTex a -> IO (a, TexLog, Maybe ByteString) Source #
Run a tex process, keeping the resulting PDF. The OnlineTex must receive the terminating control sequence (\bye, \end{document}, \stoptext).
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.