texrunner-0.0.1.2: Functions for running Tex from Haskell.

Copyright(c) 2015 Christopher Chalmers
LicenseBSD-style (see LICENSE)
Maintainerc.chalmers@me.com
Safe HaskellNone
LanguageHaskell2010

System.Texrunner.Online

Contents

Description

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.

Synopsis

Documentation

data OnlineTex a Source #

Type for dealing with Tex's piping interface; the current streams are available though the MonadReader instance.

Instances
Monad OnlineTex Source # 
Instance details

Defined in System.Texrunner.Online

Methods

(>>=) :: OnlineTex a -> (a -> OnlineTex b) -> OnlineTex b #

(>>) :: OnlineTex a -> OnlineTex b -> OnlineTex b #

return :: a -> OnlineTex a #

fail :: String -> OnlineTex a #

Functor OnlineTex Source # 
Instance details

Defined in System.Texrunner.Online

Methods

fmap :: (a -> b) -> OnlineTex a -> OnlineTex b #

(<$) :: a -> OnlineTex b -> OnlineTex a #

Applicative OnlineTex Source # 
Instance details

Defined in System.Texrunner.Online

Methods

pure :: a -> OnlineTex a #

(<*>) :: OnlineTex (a -> b) -> OnlineTex a -> OnlineTex b #

liftA2 :: (a -> b -> c) -> OnlineTex a -> OnlineTex b -> OnlineTex c #

(*>) :: OnlineTex a -> OnlineTex b -> OnlineTex b #

(<*) :: OnlineTex a -> OnlineTex b -> OnlineTex a #

MonadIO OnlineTex Source # 
Instance details

Defined in System.Texrunner.Online

Methods

liftIO :: IO a -> OnlineTex a #

MonadReader TexStreams OnlineTex Source # 
Instance details

Defined in System.Texrunner.Online

Running Tex online

runOnlineTex Source #

Arguments

:: 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.

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.

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.