Getting started with plasTeX
Arnold, Tim
We discuss plas\TeX, a software package for converting \LaTeX\ documents to other markup languages. We will cover typical usage with examples of how to create \acro{HTML} and DocBook \acro{XML} from \LaTeX\ sources. We finish with a demonstration of converting a simple \LaTeX\ source file and a brief overview of how to extend the package to handle custom commands and environments.
 Today I'll talk about getting started with Plastic, which is something I use every day. I work for Sass Institute, which is an analytical self-wear company that does business intelligence. The documents I work with are highly mathematically dense, so Plastic has got a job to do. So we'll talk about what is it in the first place and in what conditions you might find it useful. How it works. I won't go into much detail about how it works because probably you don't care, but you need to know a little bit about the underlying mechanism to take advantage of it. Basically there's an interface and there's two steps, the parsing and the rendering. So those are the two big parts of Plastic. The goal with parsing is to generate a document object model or DOM. This is kind of a tree structure of data and you can extend that with Python classes. And the next step, which is the rendering, the goal is to get our help put and that's extensible with templates. We'll take a look at a demo so you can see it in action. The normal sample 2e.tech that comes with the tech distribution just to have something to start with. And then we'll take a look at a couple of papers I downloaded from archive.org. And finally we'll have a summary. So Plastic converts latex sources to HTML, XML and other market languages. It's released as open source under the MIT license, which is a very permissive license. And it's written in pure Python by Kevin Smith, who is also an employee at SAS. My contribution to this project is haranguing Kevin at lunch for about two years to get him to write this. I use it as part of the publishing workflow to create our statistical documentation at SAS. Just to give you a brief overview about where I'm coming from. At SAS, I have a system that I call SAS Latex. We take Latex markup, math, font, these math time pro 2, and a custom tag set I wrote just to facilitate things, shortcuts for our writers. Because the people that I work with, it's not technical writers in conjunction with the developers, the subject matter expert. That happens at SAS, but the people I work with, part of their job is writing. So they're developers of the software and they write. So they are using this custom tag set to facilitate their writing, but they're also developing the software at the same time. So that gets into SAS Latex system, and we make sure that it's heavy with output and with SAS programming code. So we have a system in place to make sure that the code that the reader sees is the code that generated the output. And then that tag file gets parsed by PDF Latex or bit compiled by PDF Latex to PDF. That's very important for our developers because they are active in the statistical and mathematical community and they want to make sure their papers look good. Because our audience is kind of expecting that too. And then we send the also through plastic to get HTML and XML. And we can also send it through the parser to get the sample library code for customers so they can see the actual code that got the outputs. So we have a customized tag set. Everything is written in Python, all this other stuff except Latex. And so the whole point is to get high quality PDFs and we give those out as books and as chapters. One of the books we produce is the SAS Stat User's Guide. It's a pretty good trip test because it's 8,000 pages and we produce it all as one document and we create it as chapters. Lots of hyperlinks, lots of output, a whole lot of math and a lot of code. And each night we build the system and we get about 20,000 pages per night we build. Okay, so back to plastic. So what it is good at is these conversions and one of the main things that I wanted to point out is plugable math engines. It uses DVI ping by default. And I know nobody likes having math inside their HTML to be images. And I understand that. But this is the real world and I haven't seen anything that renders math in a high quality way. I think SVG will but I think we're going to have a problem with font embedding there to get the right agreements to work. So we're using DVI ping. Once things change, this is a plugable thing. It's not built into plastic. We just call DVI ping. So we could call something else to create JS math or MathML or SVG later on. So we can adapt as technology comes along. It has translation terms for most European languages. If you need more or for other languages, it's very easy. It's just a XML file that looks for the generated text and the key. And support for multiple encodings, which is important for us because everything comes in as Latin 1, but it goes out. It might be in Windows 1252 or UTF-8 is usually what we do. But sometimes we have a restriction. So when does it make sense to use plastic? If you've got something that works on your project, there's no reason to change. But if you're starting a new project, it's an easy package to load. It's an easy package to use. And if you're dealing with projects too complex for other tools, for me, I needed something that was simple to understand. The Python classes are pretty simple. So when somebody comes to me and says, the documentation is broken, you've got a nested paragraph coming out of this environment. It was late that it takes HTML at least as it was 12 years ago when I started. That would just made me want to cry. But now with this, I can just look and see, okay, it's coming from this class. Here's the template. What's the problem? And obviously implementing a production publishing workflow. There's a lot of things that has to happen there, and this is a good way to support that. So the way we interface with plastic is through the command line. There's no GUI. But it's got a lot of switches that you can use. And some of the most important ones are to specify themes and navigational elements, which if we're going to Java help with one flavor of HTML, then we need some kind of navigation that's different than you might use in HTML help. So depending on the application that we're trying to support, we'll have a different theme and different navigation elements. We specify the input and output coding, encoding. Set counters like if we wanted, this ASS stat user's guide would be pretty hard to build into a document object model all it wants. So build those chapter by chapter so I can set the chapter counter with each build. And you can dynamically set the table of content steps. So part of your document you want only the first two headings and your details, maybe you want the first three. You can set that. Set the section number in depth. And I'll specify the image generation engine, which is another way of saying specify how to handle math. Schematic, there's a lot of stuff on here, but let me see if I can figure this out. Yeah. Oh, we hold it in. Okay. So the two big boxes, here's the latex sources. And first it does the parsing, and then next it does the rendering. So in the parsing part, we tokenize and then parse, and then it just returns the document object model after it's parsed all that stuff, put it into the dictionary of data, and then it comes back to the renderer. And then these are just sets of templates for different output formats. So we can render to plain text, dot book, or HTML. There's also a man page renderer, but I've never had a use to use that. And then we can get our different kinds of output. So once you pass the latex source in, it goes in two steps. Pars it into data and then render it to output. Okay, the parser gets your document in, it's got to recognize everything it sees, so it knows how to put that data into a structured structure. And so it understands most of the built-in latex and tech commands. You can't pass it a memoir class and expect it to expand everything the right way. You can pass it simple things and just have regular latex, macro, new macros, new commands, new environments, and it'll figure it out. But if it gets very complex, the catcode changes, it might choke on it. So what Kevin did was create Python classes to support these packages, so those come with the plastic distribution. But I can tell you, sometimes these don't have any kind of corollary in HTML or XML, like A4-Y. We don't really have any use for that in DocBook or HTML, so that's probably an empty class inside the plastic distribution. It's just so plastic won't choke when it sees use A4-Y package, it knows, okay, I know what to do with that, or at least I think I do. And then it can continue parsing. So some of these things are just meant so it can ignore it. Although there's a lot of stuff in the AMS math and graphics, there's just a different level of logic in each one of these packages. So just because it's in this list, it might not mean it does exactly what you think. But what we're trying to do is to make it where it will parse a document and at least get through it so you can start working from there if you need to. Boris? How difficult is it to write a Python class for a new page? That's a good question, and I'm going to address that in just a minute, because if it wasn't easy, I wouldn't have done it. I need something simple. So let's take an example, and we'll just take a look at the frame box commit. This is already defined in Plastic, but it's just an example we can look at. We're going to see a backslash, the word frame box, we can take two optional arguments, and then we're going to have some text. So plastic parses that document, and this is the plastic code to create that class. That's the actual code, class, frame box. We're going to have a frame box element. Some class, they're inheriting from text box command, which is something Kevin wrote, this kind of a lower level thing. This is exactly the way I live. If I have a new command or a new environment, I look to see what Kevin already has there that's close to it, and then just subclass from it. And often that's all I have to do. I've got a whole list of class with some name, and it just says pass under each one, because it knows enough already to parse it. Another great thing about this interface is we've got arms equal, and then the signature of the command, because all you have to do is put brackets around it and it knows it's going to be optional. We're going to name that width. We're going to name the second optional argument, pause, and the next part is going to be the self-content. So once we have this, we know the data we're actually looking for when we have parsed that tag. So it saves the resulting name tokens in the document data structure, and we've already got those parts named. So there's the parsing. That is one command. It would do the same thing for every command in the document. Next, we're going to render it, and it's built on templating, which is current methodology and web framework. So that really means we're going to take that document object, that data, and apply templates for every object in there, and automatically generate our document. It's extremely fast. So for example, here's a say we were coming across in our late-set source, frame box, and we want a 15 Ems of width, and note that this is important as our text. And so it comes out like that in Beamer, or it comes out like that in PDF. The data created by the parser, it needs to find a template that has the same name. So we've got name, frame box, we've got a document, and then frame box, and it's going to apply the data it has to this template. Well, I've just hard-coded a class equals fbox on this, so that doesn't have anything to do with dynamics. It's just any frame box I have is going to have that class, because I'll deal with it later in CSF. Then this is a templating language. It came from IBM. It's called a TAL. I don't know if that stands for, but probably templating something language. And attributes are going to set an attribute. The attribute is called style. It's value. It's going to be a string, and it's width. We're going to get that width from that argument that we got in the data structure. And the content that goes inside this span tag is going to be whatever content was in the frame box. So the output, hmm, can you see that at the bottom? It span class equals fbox. It just took my verbatim boilerplate there. Style equals width, column 15, and I wrote this. It didn't generate because it would have had quotes around it like it should. And then note that this is important as the text. So we went from latex source through the template, and then got our output. So we just continue to do that all the way through the document. So plastic can render the following formats, claim text, which can be useful if you need to detect a file. HTML, well-formed XML is really easy because the internal representation of a document object within Plastic is well-formed XML. It doesn't follow any particular DTD, but it is well-formed. If you're careful, you can output.book 4.5, and I'm working on 5.0 right now, the Twints and the Talix. But you can't just throw anything at Plastic and expect to get valid.book. You'll get valid XML, well-formed XML. But if you put a piece of math inside an index term, it just didn't want to be valid in.book, and there's nothing we can do about that. But if you're careful about what you do, especially avoid nesting tags, I've found that's been generally the hardest thing. You can output.book 4.5. And once you're in that, you can go to a lot of different things and be able to interchange with other publishers, too. S5 is a simple, standard-based slideshow system, which is in HTML. If you have it in Beamer, I don't know why you'd want it in HTML, but Kevin wrote the render and so I'm telling you about it. Braille Tech, it's in the Talix because it's not really part of Plastic. It's something someone wrote, I think, in the UK, but it is an open-source latex to Braille translator that is designed to handle math. And it's on Sourceforge.net. And I have ETOGS in the Talix because I have that working at SAS, but I haven't put it up at Sourceforge to make it publicly available because it's a lot harder to do it for the general case than it is for the documents I know I'm dealing with. But that'll be there soon. Okay, let's take a look at a demo. Once again, we'll take a look at sample2e.tech and a couple of papers from archive.org, which if you don't know, it's an open access to over half a million e-prints in physics, math, computer science, the hard sciences. Let's see. That'll be fun. Okay, just so you know what I'm going to do, and so I'll know what I'm supposed to do, I've got some little notes over here, examples. So we'll take a look at sample2e. Now, in this directory, you don't have anything, but I'm going to say plastic sample2e.tech because underneath, plastic is using KPSEWitch to find your files. So if you, it'll find this, but if you specify a style file, it knows where to go get it. If we haven't defined Python equivalents, it will go find it in the tech file and try to expand it. So it's using that under the covers. And so we just hit return, and I'll show you a couple of things. Okay, so you see it, I'll just scroll up to this in just a second because a lot's going to happen right here. Before we take a look at the output, I just want to show you what happened on the screen. The very first thing is it's loaded article.py, or pyc is the compile version, and that is the article class, and that's what sample2e loaded, and apparently it didn't load anything else, no other packages, we would see it there. So that came from the Python distribution. It's going to output its files to a sub directory, the same name, the job name. And it reads its templates from these locations, and if we set an environment variable, we can make it look at our own copies and we'll override the distributions. And so it's reading these from the XHTML template library because that's the default render. It tells us what it's going to use for an integer, and then it's creating some HTML. It did not know what to do with the at symbol, which I think is backslash at for the spacing. And so Kevin didn't do that, but it's an easy thing we could add. And images.tech it created, and then you're all familiar with that log screen where we're just doing laytech to get the DVI. And, okay, so we've got images off log, and then DVI created five images. Okay, and their own name to the way they should be, so let's just take a look. Okay, so there's the example document. The default theme is this green, and Kevin likes green. That's the default. So we get these bars and we get navigational elements that are all in there, and there's metadata at the top of this HTML file inside. Table of contents, so we'll just take a quick look at this. What you would expect, this is the laytech sample file, and we get some italics. We get the quotes, the footnote, and there's the footnote here at the bottom that got there. And let's see. Yeah. At the bottom? Yeah, the logo. Laytech interprets. Oh, yeah. Sub and sub? Yeah, that's what it is. But that would be, yeah. I'll give you about a thousand lines of code to implement those. Okay, well that could be done or we could overwrite it with whatever template we want to, and the way Kevin did it was if you see slash laytech, then it's going to put in the subs and supers. So I'll blame that on him. But at the top you can see there's a, we're getting breadcrumbs plus the back or previous next and up. So this is the standard stuff that you get. And then displayed text, we have unordered list and ordered list. You know, this is the kind of things you would expect. There's a little bit of math, and that's it. And if you click on content, that would take you back, in our case, to the first page. So the displayed math, those are the NGNs? They're PINs, yeah. The verse was an idea, but... Which one? The first. Oh yeah, verse is so horrible. But what do you do with verse and HTML? You have to do a lot. You could do it, but it would take a lot of work. Okay, let's... Now I'm just going to copy this over here so I don't make a mistake. What I'm doing is I'm going to render, this time instead of using the default render, that's HTML render to text. I don't want it... It wants to split files up by section, and that's why we had those several HTML files. There's no reason to do that for a text file. And so I'm setting the split level to be zero. And that's all the magic there is on the command line. And it's going to do the same thing. It loads... It has to do the same thing every time it parses. That's always identical. What happens at the end that's different is how it renders. So let's just look at index.txt. Okay, so it's trying to do as good as it can. It's still got things numbered, blank lines are where they should be. The characters are right, the quotes are right. The math it left like it was. So it just whatever was in the math that left it there, which I think that's probably the best decision you could make. And then the unordered list are asterisks and the numbered list, ordered list is the numbers, obviously. The math is there again, and the footnote is there at the end. Okay, and one last thing with this little simple file. We'll just use a dot book renderer. And what else to... Oh, there are three themes for dot book. And one is book, one is chapter, and one is article. This is an article. And if you don't use the right thing, you'll get invalid dot book. Oh, in the text. Good point. Okay, that's something that needs to be taken care of. Yeah, well, we try to keep them to a minimum. Okay, let's just take a quick look at that. XML mind is a, this version is a free XML reader and it knows dot book when it sees it. You can see up here it thinks, okay, this is dot book, stuff that I could do with it, I guess. And it's valid. There's a little mark here that says, yeah, it's okay. Of course, it's not very complicated, but it is valid. And let's see, there's something I wanted to show you, because I think it's kind of a neat idea that came from DB Latech, which is a way to go from dot book back to Latech. So if you were to, you can take this document and produce Latech back again from it. I'm just going to switch the view from their attempt at rendering dot book to something you can read to no style sheet. Okay, so the sentence was, it's good at typesetting mathematical formulas like, and we'll get an inline equation with an inline media object that is composed of two parts, an image object and a text object. The image object is obviously that ping we just created. The text object is the map, so we haven't lost the map. And if we process this with DB Latech, it'll find that tech source in the text object and reproduce the map in whatever format it's needed. So I think that's about all there is to say about that. And in the same thing for displayed map. Okay, well let's see. Oh yeah, the output directory that we've been filing these things to is right here. And if you're creating HTML, you see these CHMs, everybody know what a CHM file is? It's the Windows Compiled Help. And so you've got the files you need to create Windows Compiled Help along with the HTML. So you just feed these files into HTML Help Workshop, which is a free download from Microsoft, and you've got a Windows Compiled Help version of your document. And the same thing for Eclipse, if you're familiar with Eclipse Help or Java Help version 1 or 2, Kevin's created the auxiliary files you need just to feed that and then get that help in a browser, in a real application. And oh yeah, the main reason I changed this directory is this one right here. I made Plastic dump its internal representation. So I just wanted to show you what that looks like. Sample2e.xml, this is the way it looks to Plastic. So it's another well-formed XML file. It's got a namespace Plastic, and you can see what, make, title, everything, every element has an ID. So we've got paragraphs. And so everything is named, and let's see if there's anything interesting here to say. Title, it has a modifier, but the modifier is blank, so we could have had title star, I guess. And so everything in there looks somewhat like that. Everything is named, everything has an ID. So we can, when we're rendering this with a real template, it's not doing anything with this. I'm just showing you this to show you what it kind of looks like inside. But everything is named and everything has an ID, so we can get to each document. Okay, I wanted to show you a couple other things. This is a file that came from archive.org. And let's just take a look at what that does. This is, you know, a file from the wild. It's not sample2e.tech, so there's a little bit more involved. One thing I found on archive is that a lot of the papers there use revtech, a class that I didn't know about, and Plastic doesn't support. It looks like it would be easy to make it support it, but that's one reason I was having failures on a lot of papers from revtech. This particular one, I guess, used article in AMS math. So it's creating the math there. That'll take a second. And then we'll see what it looks like. But to be able to add a package or add a class, it's as simple as writing the Python statements, which are about as simple as what I was showing you before. You just subclass off something else and write a renderer. And that's it. Then you'll be able to parse that new class. As simple or as complex as you can do Python statements. Well, if I can do it, it's not that hard. Okay, so now we've got a paper, still an article. We've got our abstract and the table of contents. There's no reason to spend a lot of time on it, but you can see the citations are there. Those were real sites inside the file. The math is looking pretty good and it does the equation numbering outside. More math. And our breadcrumbs are going across the top, which is the default. And let's see, conclusions and discussion. So there are our bib items. These were actually put into the file as bib items. So we didn't have to make a bib tech run, but we could have to just go directly from the tech file and nothing else. Create bib tech in the interim. A big BBL file, I should say. And it looks like the titles are missing. Let's see what it looks like in the future. And chemistry as well. Yeah, these are the actual bib items. Don't recognize them, thank you. No, it's just all we ignorant. This is what it looks like inside the file. So it loaded article, AMS math and graphics. It did some stuff that we don't need to worry about. And then we just generated the whole thing. How are we doing on time? How do you have a table? Oh, like, nice. I can tell that you guys are mesmerized by this. This is another one that came out to, well, I'm not going to plastic it yet. I want to look at it. Because I had to do some tricks because I didn't know revtech before, but I knew I could see that I'm failing on preprint. I'm failing on PACS, email tag, affiliation and acknowledgments. So I just wanted to get this thing done. So I just made a new if, if plastic and set it to be false. So if I use this with latex or PDF latex, it's not going to pay any attention to all this stuff. It's just going to use revtech for like it did in the original. I added this block so that plastic is actually using this. It doesn't matter about the new if, plastic is going to ignore it. Plastic trick is always true when plastic is running. And so in that case, I decided, well, I don't know what to do. I think I'll just make preprint do nothing. I'll make a PACS, put things in text, small caps, make email be italic, affiliation, bold, centered, italic. And then this new environment acknowledgments. I just wanted to do a line break and put the word acknowledgments in small caps and then put the bolded text inside a quote environment. So I just did that in the preamble. So when plastic sees it, it'll be able to expand this and know what to do. So I didn't have to write a template to do this. If it's simple, you can just get away with latex code. If it's more complicated, like you're changing counters on a section or something like that, then you need to get back into the Python code. So a lot of things you can get away with, with this, but let's see if that's true. And EPS files, which I imagine might not look so good when we do this, but it'll convert them. I just don't think they'll look very good. Okay, so it's loading book and graphics. Okay, so we know that it's reading the right part. Otherwise, believe me, it would be choking if it was trying to rev-tech because it doesn't know what it is. Okay, creating more math. I'll make sure I'm covering everything. Internal done. No. Okay. Okay, and here this file is, and we've got our email address and italic, affiliation, okay, and our abstract and so forth. We'll just go through this rather quickly. We've got the sites are still working. Uh-huh. I think we'll make that one. Yeah. Oh, yeah? Page percent. Not that it mattered. This one? Yeah, didn't we lose like a couple of authors or something? Oh, yeah, we did. You guys are good. There is no system right now to put in every author. It just has room for more. It's a mistake. Also, the date is today. Does that mean that this particular article just had an empty date field or is there a mistake in the translation? That's a good question. I never had noticed that before. I don't think the draft is such a date. It doesn't use it. Let's just take a quick look at the, uh... Yeah, so he's just got into the fall book header, which probably has today in it. Yeah, I bet you're right. Oh, no, it's such a date. Date today, yeah. Good catch. Yeah, it's a good question. Yeah, I never thought about how that could mess you up. Are you a author, son? Yeah. Well, even in the evening, what are the pictures? Oh, the pictures, yeah. I knew you were going to ask that, because they're not very pretty. Yeah. They need to be converted to something better, you know, so... Wouldn't it take a lot of time? Well, I would assume that's what happened, is that Plastic converted using the Python image library from EPS to... Yeah, but is it possible to set up a resolution? It seems that if you just say, do it with high resolution, it will be better. Is it possible to configure different resolution? Not off the command line. I'm not sure about that. The EPS file is converted by Hashtag or Bbypng. Which one? No, it would be Plastic. Yeah, because if it's not in a math environment, if it isn't specified that, hey, go use Laytec, then... Why do resolutions use that? Python's probably thinking it needs to render for a web kind of resolution. Yeah, I don't know the... And you originally had me also quite that... Yeah, I never even looked at that. So, yeah, I'm not sure about that, but I think if it was a real project of mine, I would have a png to bring in instead. The only reason I'm lingering on this page is because of the acknowledgments environment that I set up with Laytec code. And Python's understood what to do with Plastic, I should say, put the acknowledgments in small caps. And then we've got a quote environment, and the text inside is bold. So, even though we changed what it did, Plastic understood it just from the Laytec code. Okay, and one thing that I wanted to do is to start my talk off with a command, but it slowed the machine down so much I knew that wasn't going to work. But I'll tell you why I was trying to far. I noticed that when you used the method in title for the header, the size was... Not so good, yeah. So, Plastic can control this one? I think you could, but you might have to make some changes to your tech file. I'm not sure because I don't even know what font they're using. But you could use... Right now, she's in computer modern, I think. But you could load any kind of font that you wanted to, or using Matime Pro, that'll come out as their images, but that's what's used to create the image. I think that if you put some input nodes, you will see it's too large. I have an impression that it just doesn't pick up the text size outside and just renders the market. It's difficult to hear for rendering is that the meaning of various levels of section headings is dependent on the client, not on the producer or the doctor. You really have to have control over that. Right, because we've lost context. Yeah. That's why you can't really do them all. You can make a default mapping with mind headings, the large, the couple of hours. But what might be worth looking at, however, is the simple math that has Roman letters that the limited set of re-quarters available in HTML, subscript, supercrit, you translate that to HTML. That would be good. That wouldn't be too hard. You're right. It's a simple string. When we were running... We don't recognize you give it a text. Exactly. And that's the way Kevin had things running at one time. But it says, we had complaints from the writers that they did not like to see it mixed. Because they'd have one equation that happened to work out in simple math, and the next one didn't. But they were supposed to be showing the similarities between these two with one difference. And it did look kind of odd that way. I downloaded the Python library reference. At one time, Python's documentation was all written in latex. So I just downloaded the whole thing, and I just said, plastic lib. And then 45 minutes later, which you see why I didn't do that, for my talk, we got the Python library reference. It made it all the way through. It didn't choke anymore. Some things could look better, but let's go through here. Take a look at... There we've got nested TOCs. Take a look at that. It looks okay. It could look better. But that was just using plastic and lib.tech, which fired up... All these tech files are just included into lib.tech. So for me, that was pretty impressive. 45 minutes, it didn't choke on anything. And I know it's standard latex. I mean, there isn't a lot of fancy stuff in there. But it did make it through, and we actually have a working library reference now. Okay. I think that's it. Thank you. I have a question. If there are two questions, actually, one, do you have any slides to support DocNet? I guess not, since I don't know what that is. Before that, we do Microsoft document format, but supposedly uses an open XML... Oh, right. Yeah, I know what we're talking about. If I need to write a paper and they will only accept it in Word, then... Yeah, I know what you're talking about. Actually, I get requests to have things put into RTF in Word, but it sounds... And I think the thing to do is go to DocBook, and then you can output RTF. And I would imagine you could open off his XML. Yeah, but what is Microsoft? Microsoft is still in the picture. Well, what are we supposed to do? I mean, what can you do? Well, yeah, but the question is probably the same on the... Yeah. Chris is going to ask you, can you do the... Looking at MathML converters... I'll just go to the email section a little bit more. I thought that MathML converters have you been looking at? No, well, I haven't spent much time looking at MathML converters, because I took a look at MathML renders, and until we have something that does a great job, not just an okay job, SAS doesn't want to mess with it, but of course we've got customers to please. And right now, I think... I don't know what the problem is with the Math as images. To me, it looks pretty good, unless you rescale it a lot. In which case, obviously it looks bad, but our customers, I don't think, have that expectation. No, that's the only problem there. Chris. We're coming back to... Thank you....usually quite in a different way. You're using this as a future documentation or just for paper? No, it's all the documentation. Online documentation. Online. That's right. It presumably has a lot of cross-references. Lots of cross-references. Bibliographies. Things to code and things like that. Listings, outputs, math. So you actually need the MathML, because you wanted to link the math to that stuff, but for some days, no? I want to change the MathML once it's a standard, yeah. Yeah. Yeah, definitely. I'm not against math. The next question is, do you know if the plastic people are working on... They're not working on a renderer. They would like to... A converter. Yeah, I'm sorry. That's what I meant, too. They're not working on that. That's why it's meant as a plug-in, so we can take expertise from people that are more expert. So, I mean... Well, you looked at TTH and... You went and asked, and all these other people who want to use plastic need to get together with them. They look... Somehow, we need to get a group together to do that. Well, I hear you, but we're customer-driven, and we aren't driven by that yet. I think we will be, but I don't think we're there yet. A renderer just looks horrible. Yeah, a lot of these things with customers, if they don't know it's possible, they don't know the answer to it. Well, but if you've seen the math with a... They don't know if you want to click on an equation and get it sent off to your SAS program or Mathematica or whatever. Well, that's neat, but I think we're concerned about how it looks as well, and so far, personally, I haven't seen anything that looks good. Let me take an example of the not-exactly-arrival to your... Okay....for the very similar or a validation map, where they have got all the documentation with these little links and maps, because they've got all the math and maps. And okay, yeah, the rendering is to be the problem, but don't indent it that way. That'll be great. Had a question? Comments? Yeah. You know, a comment that the DNM offers about two weeks ago. It had a publication of an article in research that was funded by Design Science... on approval for German students that went through every single facilitator from the back tool and the back mount in a very detailed way. It's a great thing. Yeah Nice I'm looking forward to reading them
 Today I'll talk about getting started with Plastic, which is something I use every day.  I work for Sass Institute, which is an analytical self-wear company that does business intelligence.  The documents I work with are highly mathematically dense, so Plastic has got a job to do.  So we'll talk about what is it in the first place and in what conditions you might find it useful.  How it works. I won't go into much detail about how it works because probably you don't care,  but you need to know a little bit about the underlying mechanism to take advantage of it.  Basically there's an interface and there's two steps, the parsing and the rendering.  So those are the two big parts of Plastic.  The goal with parsing is to generate a document object model or DOM.  This is kind of a tree structure of data and you can extend that with Python classes.  And the next step, which is the rendering, the goal is to get our help put and that's extensible with templates.  We'll take a look at a demo so you can see it in action.  The normal sample 2e.tech that comes with the tech distribution just to have something to start with.  And then we'll take a look at a couple of papers I downloaded from archive.org.  And finally we'll have a summary.  So Plastic converts latex sources to HTML, XML and other market languages.  It's released as open source under the MIT license, which is a very permissive license.  And it's written in pure Python by Kevin Smith, who is also an employee at SAS.  My contribution to this project is haranguing Kevin at lunch for about two years to get him to write this.  I use it as part of the publishing workflow to create our statistical documentation at SAS.  Just to give you a brief overview about where I'm coming from.  At SAS, I have a system that I call SAS Latex.  We take Latex markup, math, font, these math time pro 2, and a custom tag set I wrote just to facilitate things, shortcuts for our writers.  Because the people that I work with, it's not technical writers in conjunction with the developers, the subject matter expert.  That happens at SAS, but the people I work with, part of their job is writing.  So they're developers of the software and they write.  So they are using this custom tag set to facilitate their writing, but they're also developing the software at the same time.  So that gets into SAS Latex system, and we make sure that it's heavy with output and with SAS programming code.  So we have a system in place to make sure that the code that the reader sees is the code that generated the output.  And then that tag file gets parsed by PDF Latex or bit compiled by PDF Latex to PDF.  That's very important for our developers because they are active in the statistical and mathematical community and they want to make sure their papers look good.  Because our audience is kind of expecting that too.  And then we send the also through plastic to get HTML and XML.  And we can also send it through the parser to get the sample library code for customers so they can see the actual code that got the outputs.  So we have a customized tag set. Everything is written in Python, all this other stuff except Latex.  And so the whole point is to get high quality PDFs and we give those out as books and as chapters.  One of the books we produce is the SAS Stat User's Guide. It's a pretty good trip test because it's 8,000 pages and we produce it all as one document and we create it as chapters.  Lots of hyperlinks, lots of output, a whole lot of math and a lot of code.  And each night we build the system and we get about 20,000 pages per night we build.  Okay, so back to plastic. So what it is good at is these conversions and one of the main things that I wanted to point out is plugable math engines.  It uses DVI ping by default. And I know nobody likes having math inside their HTML to be images.  And I understand that. But this is the real world and I haven't seen anything that renders math in a high quality way.  I think SVG will but I think we're going to have a problem with font embedding there to get the right agreements to work.  So we're using DVI ping. Once things change, this is a plugable thing. It's not built into plastic. We just call DVI ping.  So we could call something else to create JS math or MathML or SVG later on.  So we can adapt as technology comes along.  It has translation terms for most European languages. If you need more or for other languages, it's very easy.  It's just a XML file that looks for the generated text and the key.  And support for multiple encodings, which is important for us because everything comes in as Latin 1, but it goes out.  It might be in Windows 1252 or UTF-8 is usually what we do. But sometimes we have a restriction.  So when does it make sense to use plastic? If you've got something that works on your project, there's no reason to change.  But if you're starting a new project, it's an easy package to load. It's an easy package to use.  And if you're dealing with projects too complex for other tools, for me, I needed something that was simple to understand.  The Python classes are pretty simple. So when somebody comes to me and says, the documentation is broken, you've got a nested paragraph coming out of this environment.  It was late that it takes HTML at least as it was 12 years ago when I started. That would just made me want to cry.  But now with this, I can just look and see, okay, it's coming from this class. Here's the template. What's the problem?  And obviously implementing a production publishing workflow.  There's a lot of things that has to happen there, and this is a good way to support that.  So the way we interface with plastic is through the command line. There's no GUI.  But it's got a lot of switches that you can use. And some of the most important ones are to specify themes and navigational elements,  which if we're going to Java help with one flavor of HTML, then we need some kind of navigation that's different than you might use in HTML help.  So depending on the application that we're trying to support, we'll have a different theme and different navigation elements.  We specify the input and output coding, encoding.  Set counters like if we wanted, this ASS stat user's guide would be pretty hard to build into a document object model all it wants.  So build those chapter by chapter so I can set the chapter counter with each build.  And you can dynamically set the table of content steps. So part of your document you want only the first two headings and your details,  maybe you want the first three. You can set that. Set the section number in depth.  And I'll specify the image generation engine, which is another way of saying specify how to handle math.  Schematic, there's a lot of stuff on here, but let me see if I can figure this out.  Yeah. Oh, we hold it in. Okay. So the two big boxes, here's the latex sources.  And first it does the parsing, and then next it does the rendering.  So in the parsing part, we tokenize and then parse, and then it just returns the document object model after it's parsed all that stuff,  put it into the dictionary of data, and then it comes back to the renderer.  And then these are just sets of templates for different output formats.  So we can render to plain text, dot book, or HTML. There's also a man page renderer, but I've never had a use to use that.  And then we can get our different kinds of output.  So once you pass the latex source in, it goes in two steps.  Pars it into data and then render it to output.  Okay, the parser gets your document in, it's got to recognize everything it sees, so it knows how to put that data into a structured structure.  And so it understands most of the built-in latex and tech commands.  You can't pass it a memoir class and expect it to expand everything the right way.  You can pass it simple things and just have regular latex, macro, new macros, new commands, new environments,  and it'll figure it out. But if it gets very complex, the catcode changes, it might choke on it.  So what Kevin did was create Python classes to support these packages, so those come with the plastic distribution.  But I can tell you, sometimes these don't have any kind of corollary in HTML or XML, like A4-Y.  We don't really have any use for that in DocBook or HTML, so that's probably an empty class inside the plastic distribution.  It's just so plastic won't choke when it sees use A4-Y package, it knows, okay, I know what to do with that, or at least I think I do.  And then it can continue parsing. So some of these things are just meant so it can ignore it.  Although there's a lot of stuff in the AMS math and graphics, there's just a different level of logic in each one of these packages.  So just because it's in this list, it might not mean it does exactly what you think.  But what we're trying to do is to make it where it will parse a document and at least get through it so you can start working from there if you need to.  Boris?  How difficult is it to write a Python class for a new page?  That's a good question, and I'm going to address that in just a minute, because if it wasn't easy, I wouldn't have done it.  I need something simple. So let's take an example, and we'll just take a look at the frame box commit.  This is already defined in Plastic, but it's just an example we can look at.  We're going to see a backslash, the word frame box, we can take two optional arguments, and then we're going to have some text.  So plastic parses that document, and this is the plastic code to create that class.  That's the actual code, class, frame box. We're going to have a frame box element.  Some class, they're inheriting from text box command, which is something Kevin wrote, this kind of a lower level thing.  This is exactly the way I live. If I have a new command or a new environment, I look to see what Kevin already has there that's close to it, and then just subclass from it.  And often that's all I have to do. I've got a whole list of class with some name, and it just says pass under each one, because it knows enough already to parse it.  Another great thing about this interface is we've got arms equal, and then the signature of the command, because all you have to do is put brackets around it and it knows it's going to be optional.  We're going to name that width. We're going to name the second optional argument, pause, and the next part is going to be the self-content.  So once we have this, we know the data we're actually looking for when we have parsed that tag.  So it saves the resulting name tokens in the document data structure, and we've already got those parts named.  So there's the parsing. That is one command. It would do the same thing for every command in the document.  Next, we're going to render it, and it's built on templating, which is current methodology and web framework.  So that really means we're going to take that document object, that data, and apply templates for every object in there, and automatically generate our document.  It's extremely fast. So for example, here's a say we were coming across in our late-set source, frame box, and we want a 15 Ems of width, and note that this is important as our text.  And so it comes out like that in Beamer, or it comes out like that in PDF. The data created by the parser, it needs to find a template that has the same name.  So we've got name, frame box, we've got a document, and then frame box, and it's going to apply the data it has to this template.  Well, I've just hard-coded a class equals fbox on this, so that doesn't have anything to do with dynamics.  It's just any frame box I have is going to have that class, because I'll deal with it later in CSF.  Then this is a templating language. It came from IBM. It's called a TAL. I don't know if that stands for, but probably templating something language.  And attributes are going to set an attribute. The attribute is called style. It's value. It's going to be a string, and it's width.  We're going to get that width from that argument that we got in the data structure.  And the content that goes inside this span tag is going to be whatever content was in the frame box.  So the output, hmm, can you see that at the bottom?  It span class equals fbox. It just took my verbatim boilerplate there.  Style equals width, column 15, and I wrote this. It didn't generate because it would have had quotes around it like it should.  And then note that this is important as the text.  So we went from latex source through the template, and then got our output.  So we just continue to do that all the way through the document.  So plastic can render the following formats, claim text, which can be useful if you need to detect a file.  HTML, well-formed XML is really easy because the internal representation of a document object within Plastic is well-formed XML.  It doesn't follow any particular DTD, but it is well-formed.  If you're careful, you can output.book 4.5, and I'm working on 5.0 right now, the Twints and the Talix.  But you can't just throw anything at Plastic and expect to get valid.book.  You'll get valid XML, well-formed XML.  But if you put a piece of math inside an index term, it just didn't want to be valid in.book, and there's nothing we can do about that.  But if you're careful about what you do, especially avoid nesting tags, I've found that's been generally the hardest thing.  You can output.book 4.5.  And once you're in that, you can go to a lot of different things and be able to interchange with other publishers, too.  S5 is a simple, standard-based slideshow system, which is in HTML.  If you have it in Beamer, I don't know why you'd want it in HTML, but Kevin wrote the render and so I'm telling you about it.  Braille Tech, it's in the Talix because it's not really part of Plastic.  It's something someone wrote, I think, in the UK, but it is an open-source latex to Braille translator that is designed to handle math.  And it's on Sourceforge.net.  And I have ETOGS in the Talix because I have that working at SAS, but I haven't put it up at Sourceforge to make it publicly available  because it's a lot harder to do it for the general case than it is for the documents I know I'm dealing with.  But that'll be there soon.  Okay, let's take a look at a demo.  Once again, we'll take a look at sample2e.tech and a couple of papers from archive.org,  which if you don't know, it's an open access to over half a million e-prints in physics, math, computer science, the hard sciences.  Let's see.  That'll be fun.  Okay, just so you know what I'm going to do, and so I'll know what I'm supposed to do, I've got some little notes over here, examples.  So we'll take a look at sample2e.  Now, in this directory, you don't have anything, but I'm going to say plastic sample2e.tech  because underneath, plastic is using KPSEWitch to find your files.  So if you, it'll find this, but if you specify a style file, it knows where to go get it.  If we haven't defined Python equivalents, it will go find it in the tech file and try to expand it.  So it's using that under the covers.  And so we just hit return, and I'll show you a couple of things.  Okay, so you see it, I'll just scroll up to this in just a second because a lot's going to happen right here.  Before we take a look at the output, I just want to show you what happened on the screen.  The very first thing is it's loaded article.py, or pyc is the compile version, and that is the article class,  and that's what sample2e loaded, and apparently it didn't load anything else, no other packages, we would see it there.  So that came from the Python distribution. It's going to output its files to a sub directory, the same name, the job name.  And it reads its templates from these locations, and if we set an environment variable, we can make it look at our own copies  and we'll override the distributions.  And so it's reading these from the XHTML template library because that's the default render.  It tells us what it's going to use for an integer, and then it's creating some HTML.  It did not know what to do with the at symbol, which I think is backslash at for the spacing.  And so Kevin didn't do that, but it's an easy thing we could add.  And images.tech it created, and then you're all familiar with that log screen where we're just doing laytech to get the DVI.  And, okay, so we've got images off log, and then DVI created five images.  Okay, and their own name to the way they should be, so let's just take a look.  Okay, so there's the example document. The default theme is this green, and Kevin likes green. That's the default.  So we get these bars and we get navigational elements that are all in there, and there's metadata at the top of this HTML file inside.  Table of contents, so we'll just take a quick look at this.  What you would expect, this is the laytech sample file, and we get some italics.  We get the quotes, the footnote, and there's the footnote here at the bottom that got there.  And let's see. Yeah.  At the bottom? Yeah, the logo.  Laytech interprets. Oh, yeah.  Sub and sub? Yeah, that's what it is.  But that would be, yeah.  I'll give you about a thousand lines of code to implement those.  Okay, well that could be done or we could overwrite it with whatever template we want to, and the way Kevin did it was if you see slash laytech, then it's going to put in the subs and supers.  So I'll blame that on him.  But at the top you can see there's a, we're getting breadcrumbs plus the back or previous next and up.  So this is the standard stuff that you get. And then displayed text, we have unordered list and ordered list.  You know, this is the kind of things you would expect. There's a little bit of math, and that's it.  And if you click on content, that would take you back, in our case, to the first page.  So the displayed math, those are the NGNs? They're PINs, yeah.  The verse was an idea, but... Which one?  The first. Oh yeah, verse is so horrible.  But what do you do with verse and HTML? You have to do a lot. You could do it, but it would take a lot of work.  Okay, let's... Now I'm just going to copy this over here so I don't make a mistake.  What I'm doing is I'm going to render, this time instead of using the default render, that's HTML render to text.  I don't want it... It wants to split files up by section, and that's why we had those several HTML files.  There's no reason to do that for a text file. And so I'm setting the split level to be zero.  And that's all the magic there is on the command line.  And it's going to do the same thing. It loads... It has to do the same thing every time it parses.  That's always identical. What happens at the end that's different is how it renders.  So let's just look at index.txt.  Okay, so it's trying to do as good as it can. It's still got things numbered, blank lines are where they should be.  The characters are right, the quotes are right. The math it left like it was.  So it just whatever was in the math that left it there, which I think that's probably the best decision you could make.  And then the unordered list are asterisks and the numbered list, ordered list is the numbers, obviously.  The math is there again, and the footnote is there at the end.  Okay, and one last thing with this little simple file.  We'll just use a dot book renderer. And what else to... Oh, there are three themes for dot book.  And one is book, one is chapter, and one is article. This is an article.  And if you don't use the right thing, you'll get invalid dot book.  Oh, in the text.  Good point. Okay, that's something that needs to be taken care of.  Yeah, well, we try to keep them to a minimum.  Okay, let's just take a quick look at that.  XML mind is a, this version is a free XML reader and it knows dot book when it sees it.  You can see up here it thinks, okay, this is dot book, stuff that I could do with it, I guess.  And it's valid. There's a little mark here that says, yeah, it's okay.  Of course, it's not very complicated, but it is valid.  And let's see, there's something I wanted to show you, because I think it's kind of a neat idea that came from DB Latech,  which is a way to go from dot book back to Latech.  So if you were to, you can take this document and produce Latech back again from it.  I'm just going to switch the view from their attempt at rendering dot book to something you can read to no style sheet.  Okay, so the sentence was, it's good at typesetting mathematical formulas like,  and we'll get an inline equation with an inline media object that is composed of two parts, an image object and a text object.  The image object is obviously that ping we just created.  The text object is the map, so we haven't lost the map.  And if we process this with DB Latech, it'll find that tech source in the text object and reproduce the map in whatever format it's needed.  So I think that's about all there is to say about that.  And in the same thing for displayed map.  Okay, well let's see.  Oh yeah, the output directory that we've been filing these things to is right here.  And if you're creating HTML, you see these CHMs, everybody know what a CHM file is?  It's the Windows Compiled Help.  And so you've got the files you need to create Windows Compiled Help along with the HTML.  So you just feed these files into HTML Help Workshop, which is a free download from Microsoft,  and you've got a Windows Compiled Help version of your document.  And the same thing for Eclipse, if you're familiar with Eclipse Help or Java Help version 1 or 2,  Kevin's created the auxiliary files you need just to feed that and then get that help in a browser, in a real application.  And oh yeah, the main reason I changed this directory is this one right here.  I made Plastic dump its internal representation.  So I just wanted to show you what that looks like.  Sample2e.xml, this is the way it looks to Plastic.  So it's another well-formed XML file.  It's got a namespace Plastic, and you can see what, make, title, everything, every element has an ID.  So we've got paragraphs.  And so everything is named, and let's see if there's anything interesting here to say.  Title, it has a modifier, but the modifier is blank, so we could have had title star, I guess.  And so everything in there looks somewhat like that.  Everything is named, everything has an ID.  So we can, when we're rendering this with a real template, it's not doing anything with this.  I'm just showing you this to show you what it kind of looks like inside.  But everything is named and everything has an ID, so we can get to each document.  Okay, I wanted to show you a couple other things.  This is a file that came from archive.org.  And let's just take a look at what that does.  This is, you know, a file from the wild.  It's not sample2e.tech, so there's a little bit more involved.  One thing I found on archive is that a lot of the papers there use revtech, a class that I didn't know about, and Plastic doesn't support.  It looks like it would be easy to make it support it, but that's one reason I was having failures on a lot of papers from revtech.  This particular one, I guess, used article in AMS math.  So it's creating the math there.  That'll take a second.  And then we'll see what it looks like.  But to be able to add a package or add a class, it's as simple as writing the Python statements, which are about as simple as what I was showing you before.  You just subclass off something else and write a renderer.  And that's it. Then you'll be able to parse that new class.  As simple or as complex as you can do Python statements.  Well, if I can do it, it's not that hard.  Okay, so now we've got a paper, still an article.  We've got our abstract and the table of contents.  There's no reason to spend a lot of time on it, but you can see the citations are there.  Those were real sites inside the file.  The math is looking pretty good and it does the equation numbering outside.  More math.  And our breadcrumbs are going across the top, which is the default.  And let's see, conclusions and discussion.  So there are our bib items.  These were actually put into the file as bib items.  So we didn't have to make a bib tech run, but we could have to just go directly from the tech file and nothing else.  Create bib tech in the interim.  A big BBL file, I should say.  And it looks like the titles are missing.  Let's see what it looks like in the future.  And chemistry as well.  Yeah, these are the actual bib items.  Don't recognize them, thank you.  No, it's just all we ignorant.  This is what it looks like inside the file.  So it loaded article, AMS math and graphics.  It did some stuff that we don't need to worry about.  And then we just generated the whole thing.  How are we doing on time?  How do you have a table?  Oh, like, nice.  I can tell that you guys are mesmerized by this.  This is another one that came out to, well, I'm not going to plastic it yet.  I want to look at it.  Because I had to do some tricks because I didn't know revtech before, but I knew I could see that I'm failing on preprint.  I'm failing on PACS, email tag, affiliation and acknowledgments.  So I just wanted to get this thing done.  So I just made a new if, if plastic and set it to be false.  So if I use this with latex or PDF latex, it's not going to pay any attention to all this stuff.  It's just going to use revtech for like it did in the original.  I added this block so that plastic is actually using this.  It doesn't matter about the new if, plastic is going to ignore it.  Plastic trick is always true when plastic is running.  And so in that case, I decided, well, I don't know what to do.  I think I'll just make preprint do nothing.  I'll make a PACS, put things in text, small caps, make email be italic, affiliation, bold, centered, italic.  And then this new environment acknowledgments.  I just wanted to do a line break and put the word acknowledgments in small caps and then put the bolded text inside a quote environment.  So I just did that in the preamble.  So when plastic sees it, it'll be able to expand this and know what to do.  So I didn't have to write a template to do this.  If it's simple, you can just get away with latex code.  If it's more complicated, like you're changing counters on a section or something like that, then you need to get back into the Python code.  So a lot of things you can get away with, with this, but let's see if that's true.  And EPS files, which I imagine might not look so good when we do this, but it'll convert them.  I just don't think they'll look very good.  Okay, so it's loading book and graphics.  Okay, so we know that it's reading the right part.  Otherwise, believe me, it would be choking if it was trying to rev-tech because it doesn't know what it is.  Okay, creating more math.  I'll make sure I'm covering everything.  Internal done.  No.  Okay.  Okay, and here this file is, and we've got our email address and italic, affiliation, okay, and our abstract and so forth.  We'll just go through this rather quickly.  We've got the sites are still working.  Uh-huh.  I think we'll make that one.  Yeah.  Oh, yeah?  Page percent.  Not that it mattered.  This one?  Yeah, didn't we lose like a couple of authors or something?  Oh, yeah, we did.  You guys are good.  There is no system right now to put in every author.  It just has room for more.  It's a mistake.  Also, the date is today.  Does that mean that this particular article just had an empty date field or is there a mistake in the translation?  That's a good question.  I never had noticed that before.  I don't think the draft is such a date.  It doesn't use it.  Let's just take a quick look at the, uh...  Yeah, so he's just got into the fall book header, which probably has today in it.  Yeah, I bet you're right.  Oh, no, it's such a date.  Date today, yeah.  Good catch.  Yeah, it's a good question.  Yeah, I never thought about how that could mess you up.  Are you a author, son?  Yeah.  Well, even in the evening, what are the pictures?  Oh, the pictures, yeah.  I knew you were going to ask that, because they're not very pretty.  Yeah.  They need to be converted to something better, you know, so...  Wouldn't it take a lot of time?  Well, I would assume that's what happened, is that Plastic converted using the Python image library from EPS to...  Yeah, but is it possible to set up a resolution?  It seems that if you just say, do it with high resolution, it will be better.  Is it possible to configure different resolution?  Not off the command line.  I'm not sure about that.  The EPS file is converted by Hashtag or Bbypng.  Which one?  No, it would be Plastic.  Yeah, because if it's not in a math environment, if it isn't specified that, hey, go use Laytec, then...  Why do resolutions use that?  Python's probably thinking it needs to render for a web kind of resolution.  Yeah, I don't know the...  And you originally had me also quite that...  Yeah, I never even looked at that.  So, yeah, I'm not sure about that, but I think if it was a real project of mine, I would have a png to bring in instead.  The only reason I'm lingering on this page is because of the acknowledgments environment that I set up with Laytec code.  And Python's understood what to do with Plastic, I should say, put the acknowledgments in small caps.  And then we've got a quote environment, and the text inside is bold.  So, even though we changed what it did, Plastic understood it just from the Laytec code.  Okay, and one thing that I wanted to do is to start my talk off with a command, but it slowed the machine down so much I knew that wasn't going to work.  But I'll tell you why I was trying to far.  I noticed that when you used the method in title for the header, the size was...  Not so good, yeah.  So, Plastic can control this one?  I think you could, but you might have to make some changes to your tech file.  I'm not sure because I don't even know what font they're using.  But you could use... Right now, she's in computer modern, I think.  But you could load any kind of font that you wanted to, or using Matime Pro, that'll come out as their images, but that's what's used to create the image.  I think that if you put some input nodes, you will see it's too large.  I have an impression that it just doesn't pick up the text size outside and just renders the market.  It's difficult to hear for rendering is that the meaning of various levels of section headings is dependent on the client, not on the producer or the doctor.  You really have to have control over that.  Right, because we've lost context.  Yeah.  That's why you can't really do them all.  You can make a default mapping with mind headings, the large, the couple of hours.  But what might be worth looking at, however, is the simple math that has Roman letters that the limited set of re-quarters available in HTML,  subscript, supercrit, you translate that to HTML.  That would be good.  That wouldn't be too hard.  You're right.  It's a simple string.  When we were running...  We don't recognize you give it a text.  Exactly.  And that's the way Kevin had things running at one time.  But it says, we had complaints from the writers that they did not like to see it mixed.  Because they'd have one equation that happened to work out in simple math, and the next one didn't.  But they were supposed to be showing the similarities between these two with one difference.  And it did look kind of odd that way.  I downloaded the Python library reference.  At one time, Python's documentation was all written in latex.  So I just downloaded the whole thing, and I just said, plastic lib.  And then 45 minutes later, which you see why I didn't do that, for my talk, we got the Python library reference.  It made it all the way through.  It didn't choke anymore.  Some things could look better, but let's go through here.  Take a look at...  There we've got nested TOCs.  Take a look at that.  It looks okay.  It could look better.  But that was just using plastic and lib.tech, which fired up...  All these tech files are just included into lib.tech.  So for me, that was pretty impressive.  45 minutes, it didn't choke on anything.  And I know it's standard latex.  I mean, there isn't a lot of fancy stuff in there.  But it did make it through, and we actually have a working library reference now.  Okay.  I think that's it.  Thank you.  I have a question.  If there are two questions, actually, one, do you have any slides to support DocNet?  I guess not, since I don't know what that is.  Before that, we do Microsoft document format, but supposedly uses an open XML...  Oh, right.  Yeah, I know what we're talking about.  If I need to write a paper and they will only accept it in Word, then...  Yeah, I know what you're talking about.  Actually, I get requests to have things put into RTF in Word, but it sounds...  And I think the thing to do is go to DocBook, and then you can output RTF.  And I would imagine you could open off his XML.  Yeah, but what is Microsoft?  Microsoft is still in the picture.  Well, what are we supposed to do?  I mean, what can you do?  Well, yeah, but the question is probably the same on the...  Yeah.  Chris is going to ask you, can you do the...  Looking at MathML converters...  I'll just go to the email section a little bit more.  I thought that MathML converters have you been looking at?  No, well, I haven't spent much time looking at MathML converters,  because I took a look at MathML renders, and until we have something that does a great job,  not just an okay job, SAS doesn't want to mess with it,  but of course we've got customers to please.  And right now, I think...  I don't know what the problem is with the Math as images.  To me, it looks pretty good, unless you rescale it a lot.  In which case, obviously it looks bad,  but our customers, I don't think, have that expectation.  No, that's the only problem there.  Chris.  We're coming back to...  Thank you. ...usually quite in a different way.  You're using this as a future documentation or just for paper?  No, it's all the documentation.  Online documentation.  Online. That's right.  It presumably has a lot of cross-references.  Lots of cross-references.  Bibliographies.  Things to code and things like that.  Listings, outputs, math.  So you actually need the MathML, because you wanted to link the math to that stuff,  but for some days, no?  I want to change the MathML once it's a standard, yeah.  Yeah.  Yeah, definitely. I'm not against math.  The next question is, do you know if the plastic people are working on...  They're not working on a renderer.  They would like to...  A converter.  Yeah, I'm sorry. That's what I meant, too.  They're not working on that.  That's why it's meant as a plug-in, so we can take expertise from people that are more expert.  So, I mean...  Well, you looked at TTH and...  You went and asked, and all these other people who want to use plastic need to get together with them.  They look... Somehow, we need to get a group together to do that.  Well, I hear you, but we're customer-driven, and we aren't driven by that yet.  I think we will be, but I don't think we're there yet.  A renderer just looks horrible.  Yeah, a lot of these things with customers, if they don't know it's possible, they don't know the answer to it.  Well, but if you've seen the math with a...  They don't know if you want to click on an equation and get it sent off to your SAS program or Mathematica or whatever.  Well, that's neat, but I think we're concerned about how it looks as well, and so far, personally, I haven't seen anything that looks good.  Let me take an example of the not-exactly-arrival to your...  Okay. ...for the very similar or a validation map, where they have got all the documentation with these little links and maps,  because they've got all the math and maps.  And okay, yeah, the rendering is to be the problem, but don't indent it that way.  That'll be great.  Had a question?  Comments?  Yeah.  You know, a comment that the DNM offers about two weeks ago.  It had a publication of an article in research that was funded by Design Science...  on approval for German students that went through every single facilitator from the back tool and the back mount in a very detailed way.  It's a great thing.  Yeah  Nice I'm looking forward to reading them
Getting_started_with_plasTeX_0_59.png Getting_started_with_plasTeX_60_599.png Getting_started_with_plasTeX_600_791.png Getting_started_with_plasTeX_792_1715.png Getting_started_with_plasTeX_1716_2123.png Getting_started_with_plasTeX_2124_2963.png Getting_started_with_plasTeX_2964_6323.png Getting_started_with_plasTeX_6324_9695.png Getting_started_with_plasTeX_9696_11315.png Getting_started_with_plasTeX_11316_12743.png Getting_started_with_plasTeX_12744_15515.png Getting_started_with_plasTeX_15516_17723.png Getting_started_with_plasTeX_17724_18287.png Getting_started_with_plasTeX_18288_18743.png Getting_started_with_plasTeX_18744_20123.png Getting_started_with_plasTeX_20124_20915.png Getting_started_with_plasTeX_20916_23531.png Getting_started_with_plasTeX_23532_23975.png Getting_started_with_plasTeX_23976_24155.png Getting_started_with_plasTeX_24156_24239.png Getting_started_with_plasTeX_24240_24311.png Getting_started_with_plasTeX_24312_24467.png Getting_started_with_plasTeX_24468_28031.png Getting_started_with_plasTeX_28032_28079.png Getting_started_with_plasTeX_28080_28595.png Getting_started_with_plasTeX_28596_28715.png Getting_started_with_plasTeX_28716_30191.png Getting_started_with_plasTeX_30192_30731.png Getting_started_with_plasTeX_30732_32087.png Getting_started_with_plasTeX_32088_32279.png Getting_started_with_plasTeX_32280_33251.png Getting_started_with_plasTeX_33252_34427.png Getting_started_with_plasTeX_34428_36899.png Getting_started_with_plasTeX_36900_41867.png Getting_started_with_plasTeX_41868_47675.png Getting_started_with_plasTeX_47676_48011.png Getting_started_with_plasTeX_48012_48059.png Getting_started_with_plasTeX_48060_48371.png Getting_started_with_plasTeX_48372_48671.png Getting_started_with_plasTeX_48672_49799.png Getting_started_with_plasTeX_49800_50219.png Getting_started_with_plasTeX_50220_51551.png Getting_started_with_plasTeX_51552_51707.png Getting_started_with_plasTeX_51708_51791.png Getting_started_with_plasTeX_51792_52019.png Getting_started_with_plasTeX_52020_52619.png Getting_started_with_plasTeX_52620_52907.png Getting_started_with_plasTeX_52908_54683.png Getting_started_with_plasTeX_54684_56651.png Getting_started_with_plasTeX_56652_56867.png Getting_started_with_plasTeX_56868_56915.png Getting_started_with_plasTeX_56916_56999.png Getting_started_with_plasTeX_57000_57059.png Getting_started_with_plasTeX_57060_65447.png Getting_started_with_plasTeX_65448_65487.png
Today I'll talk about getting started with Plastic, which is something I use every day. I work for Sass Institute, which is an analytical self-wear company that does business intelligence. The documents I work with are highly mathematically dense, so Plastic has got a job to do. So we'll talk about what is it in the first place and in what conditions you might find it useful. How it works. I won't go into much detail about how it works because probably you don't care, but you need to know a little bit about the underlying mechanism to take advantage of it. Basically there's an interface and there's two steps, the parsing and the rendering. So those are the two big parts of Plastic. The goal with parsing is to generate a document object model or DOM. This is kind of a tree structure of data and you can extend that with Python classes. And the next step, which is the rendering, the goal is to get our help put and that's extensible with templates. We'll take a look at a demo so you can see it in action. The normal sample 2e.tech that comes with the tech distribution just to have something to start with. And then we'll take a look at a couple of papers I downloaded from archive.org. And finally we'll have a summary. So Plastic converts latex sources to HTML, XML and other market languages. It's released as open source under the MIT license, which is a very permissive license. And it's written in pure Python by Kevin Smith, who is also an employee at SAS. My contribution to this project is haranguing Kevin at lunch for about two years to get him to write this. I use it as part of the publishing workflow to create our statistical documentation at SAS. Just to give you a brief overview about where I'm coming from. At SAS, I have a system that I call SAS Latex. We take Latex markup, math, font, these math time pro 2, and a custom tag set I wrote just to facilitate things, shortcuts for our writers. Because the people that I work with, it's not technical writers in conjunction with the developers, the subject matter expert. That happens at SAS, but the people I work with, part of their job is writing. So they're developers of the software and they write. So they are using this custom tag set to facilitate their writing, but they're also developing the software at the same time. So that gets into SAS Latex system, and we make sure that it's heavy with output and with SAS programming code. So we have a system in place to make sure that the code that the reader sees is the code that generated the output. And then that tag file gets parsed by PDF Latex or bit compiled by PDF Latex to PDF. That's very important for our developers because they are active in the statistical and mathematical community and they want to make sure their papers look good. Because our audience is kind of expecting that too. And then we send the also through plastic to get HTML and XML. And we can also send it through the parser to get the sample library code for customers so they can see the actual code that got the outputs. So we have a customized tag set. Everything is written in Python, all this other stuff except Latex. And so the whole point is to get high quality PDFs and we give those out as books and as chapters. One of the books we produce is the SAS Stat User's Guide. It's a pretty good trip test because it's 8,000 pages and we produce it all as one document and we create it as chapters. Lots of hyperlinks, lots of output, a whole lot of math and a lot of code. And each night we build the system and we get about 20,000 pages per night we build. Okay, so back to plastic. So what it is good at is these conversions and one of the main things that I wanted to point out is plugable math engines. It uses DVI ping by default. And I know nobody likes having math inside their HTML to be images. And I understand that. But this is the real world and I haven't seen anything that renders math in a high quality way. I think SVG will but I think we're going to have a problem with font embedding there to get the right agreements to work. So we're using DVI ping. Once things change, this is a plugable thing. It's not built into plastic. We just call DVI ping. So we could call something else to create JS math or MathML or SVG later on. So we can adapt as technology comes along. It has translation terms for most European languages. If you need more or for other languages, it's very easy. It's just a XML file that looks for the generated text and the key. And support for multiple encodings, which is important for us because everything comes in as Latin 1, but it goes out. It might be in Windows 1252 or UTF-8 is usually what we do. But sometimes we have a restriction. So when does it make sense to use plastic? If you've got something that works on your project, there's no reason to change. But if you're starting a new project, it's an easy package to load. It's an easy package to use. And if you're dealing with projects too complex for other tools, for me, I needed something that was simple to understand. The Python classes are pretty simple. So when somebody comes to me and says, the documentation is broken, you've got a nested paragraph coming out of this environment. It was late that it takes HTML at least as it was 12 years ago when I started. That would just made me want to cry. But now with this, I can just look and see, okay, it's coming from this class. Here's the template. What's the problem? And obviously implementing a production publishing workflow. There's a lot of things that has to happen there, and this is a good way to support that. So the way we interface with plastic is through the command line. There's no GUI. But it's got a lot of switches that you can use. And some of the most important ones are to specify themes and navigational elements, which if we're going to Java help with one flavor of HTML, then we need some kind of navigation that's different than you might use in HTML help. So depending on the application that we're trying to support, we'll have a different theme and different navigation elements. We specify the input and output coding, encoding. Set counters like if we wanted, this ASS stat user's guide would be pretty hard to build into a document object model all it wants. So build those chapter by chapter so I can set the chapter counter with each build. And you can dynamically set the table of content steps. So part of your document you want only the first two headings and your details, maybe you want the first three. You can set that. Set the section number in depth. And I'll specify the image generation engine, which is another way of saying specify how to handle math. Schematic, there's a lot of stuff on here, but let me see if I can figure this out. Yeah. Oh, we hold it in. Okay. So the two big boxes, here's the latex sources. And first it does the parsing, and then next it does the rendering. So in the parsing part, we tokenize and then parse, and then it just returns the document object model after it's parsed all that stuff, put it into the dictionary of data, and then it comes back to the renderer. And then these are just sets of templates for different output formats. So we can render to plain text, dot book, or HTML. There's also a man page renderer, but I've never had a use to use that. And then we can get our different kinds of output. So once you pass the latex source in, it goes in two steps. Pars it into data and then render it to output. Okay, the parser gets your document in, it's got to recognize everything it sees, so it knows how to put that data into a structured structure. And so it understands most of the built-in latex and tech commands. You can't pass it a memoir class and expect it to expand everything the right way. You can pass it simple things and just have regular latex, macro, new macros, new commands, new environments, and it'll figure it out. But if it gets very complex, the catcode changes, it might choke on it. So what Kevin did was create Python classes to support these packages, so those come with the plastic distribution. But I can tell you, sometimes these don't have any kind of corollary in HTML or XML, like A4-Y. We don't really have any use for that in DocBook or HTML, so that's probably an empty class inside the plastic distribution. It's just so plastic won't choke when it sees use A4-Y package, it knows, okay, I know what to do with that, or at least I think I do. And then it can continue parsing. So some of these things are just meant so it can ignore it. Although there's a lot of stuff in the AMS math and graphics, there's just a different level of logic in each one of these packages. So just because it's in this list, it might not mean it does exactly what you think. But what we're trying to do is to make it where it will parse a document and at least get through it so you can start working from there if you need to. Boris? How difficult is it to write a Python class for a new page? That's a good question, and I'm going to address that in just a minute, because if it wasn't easy, I wouldn't have done it. I need something simple. So let's take an example, and we'll just take a look at the frame box commit. This is already defined in Plastic, but it's just an example we can look at. We're going to see a backslash, the word frame box, we can take two optional arguments, and then we're going to have some text. So plastic parses that document, and this is the plastic code to create that class. That's the actual code, class, frame box. We're going to have a frame box element. Some class, they're inheriting from text box command, which is something Kevin wrote, this kind of a lower level thing. This is exactly the way I live. If I have a new command or a new environment, I look to see what Kevin already has there that's close to it, and then just subclass from it. And often that's all I have to do. I've got a whole list of class with some name, and it just says pass under each one, because it knows enough already to parse it. Another great thing about this interface is we've got arms equal, and then the signature of the command, because all you have to do is put brackets around it and it knows it's going to be optional. We're going to name that width. We're going to name the second optional argument, pause, and the next part is going to be the self-content. So once we have this, we know the data we're actually looking for when we have parsed that tag. So it saves the resulting name tokens in the document data structure, and we've already got those parts named. So there's the parsing. That is one command. It would do the same thing for every command in the document. Next, we're going to render it, and it's built on templating, which is current methodology and web framework. So that really means we're going to take that document object, that data, and apply templates for every object in there, and automatically generate our document. It's extremely fast. So for example, here's a say we were coming across in our late-set source, frame box, and we want a 15 Ems of width, and note that this is important as our text. And so it comes out like that in Beamer, or it comes out like that in PDF. The data created by the parser, it needs to find a template that has the same name. So we've got name, frame box, we've got a document, and then frame box, and it's going to apply the data it has to this template. Well, I've just hard-coded a class equals fbox on this, so that doesn't have anything to do with dynamics. It's just any frame box I have is going to have that class, because I'll deal with it later in CSF. Then this is a templating language. It came from IBM. It's called a TAL. I don't know if that stands for, but probably templating something language. And attributes are going to set an attribute. The attribute is called style. It's value. It's going to be a string, and it's width. We're going to get that width from that argument that we got in the data structure. And the content that goes inside this span tag is going to be whatever content was in the frame box. So the output, hmm, can you see that at the bottom? It span class equals fbox. It just took my verbatim boilerplate there. Style equals width, column 15, and I wrote this. It didn't generate because it would have had quotes around it like it should. And then note that this is important as the text. So we went from latex source through the template, and then got our output. So we just continue to do that all the way through the document. So plastic can render the following formats, claim text, which can be useful if you need to detect a file. HTML, well-formed XML is really easy because the internal representation of a document object within Plastic is well-formed XML. It doesn't follow any particular DTD, but it is well-formed. If you're careful, you can output.book 4.5, and I'm working on 5.0 right now, the Twints and the Talix. But you can't just throw anything at Plastic and expect to get valid.book. You'll get valid XML, well-formed XML. But if you put a piece of math inside an index term, it just didn't want to be valid in.book, and there's nothing we can do about that. But if you're careful about what you do, especially avoid nesting tags, I've found that's been generally the hardest thing. You can output.book 4.5. And once you're in that, you can go to a lot of different things and be able to interchange with other publishers, too. S5 is a simple, standard-based slideshow system, which is in HTML. If you have it in Beamer, I don't know why you'd want it in HTML, but Kevin wrote the render and so I'm telling you about it. Braille Tech, it's in the Talix because it's not really part of Plastic. It's something someone wrote, I think, in the UK, but it is an open-source latex to Braille translator that is designed to handle math. And it's on Sourceforge.net. And I have ETOGS in the Talix because I have that working at SAS, but I haven't put it up at Sourceforge to make it publicly available because it's a lot harder to do it for the general case than it is for the documents I know I'm dealing with. But that'll be there soon. Okay, let's take a look at a demo. Once again, we'll take a look at sample2e.tech and a couple of papers from archive.org, which if you don't know, it's an open access to over half a million e-prints in physics, math, computer science, the hard sciences. Let's see. That'll be fun. Okay, just so you know what I'm going to do, and so I'll know what I'm supposed to do, I've got some little notes over here, examples. So we'll take a look at sample2e. Now, in this directory, you don't have anything, but I'm going to say plastic sample2e.tech because underneath, plastic is using KPSEWitch to find your files. So if you, it'll find this, but if you specify a style file, it knows where to go get it. If we haven't defined Python equivalents, it will go find it in the tech file and try to expand it. So it's using that under the covers. And so we just hit return, and I'll show you a couple of things. Okay, so you see it, I'll just scroll up to this in just a second because a lot's going to happen right here. Before we take a look at the output, I just want to show you what happened on the screen. The very first thing is it's loaded article.py, or pyc is the compile version, and that is the article class, and that's what sample2e loaded, and apparently it didn't load anything else, no other packages, we would see it there. So that came from the Python distribution. It's going to output its files to a sub directory, the same name, the job name. And it reads its templates from these locations, and if we set an environment variable, we can make it look at our own copies and we'll override the distributions. And so it's reading these from the XHTML template library because that's the default render. It tells us what it's going to use for an integer, and then it's creating some HTML. It did not know what to do with the at symbol, which I think is backslash at for the spacing. And so Kevin didn't do that, but it's an easy thing we could add. And images.tech it created, and then you're all familiar with that log screen where we're just doing laytech to get the DVI. And, okay, so we've got images off log, and then DVI created five images. Okay, and their own name to the way they should be, so let's just take a look. Okay, so there's the example document. The default theme is this green, and Kevin likes green. That's the default. So we get these bars and we get navigational elements that are all in there, and there's metadata at the top of this HTML file inside. Table of contents, so we'll just take a quick look at this. What you would expect, this is the laytech sample file, and we get some italics. We get the quotes, the footnote, and there's the footnote here at the bottom that got there. And let's see. Yeah. At the bottom? Yeah, the logo. Laytech interprets. Oh, yeah. Sub and sub? Yeah, that's what it is. But that would be, yeah. I'll give you about a thousand lines of code to implement those. Okay, well that could be done or we could overwrite it with whatever template we want to, and the way Kevin did it was if you see slash laytech, then it's going to put in the subs and supers. So I'll blame that on him. But at the top you can see there's a, we're getting breadcrumbs plus the back or previous next and up. So this is the standard stuff that you get. And then displayed text, we have unordered list and ordered list. You know, this is the kind of things you would expect. There's a little bit of math, and that's it. And if you click on content, that would take you back, in our case, to the first page. So the displayed math, those are the NGNs? They're PINs, yeah. The verse was an idea, but... Which one? The first. Oh yeah, verse is so horrible. But what do you do with verse and HTML? You have to do a lot. You could do it, but it would take a lot of work. Okay, let's... Now I'm just going to copy this over here so I don't make a mistake. What I'm doing is I'm going to render, this time instead of using the default render, that's HTML render to text. I don't want it... It wants to split files up by section, and that's why we had those several HTML files. There's no reason to do that for a text file. And so I'm setting the split level to be zero. And that's all the magic there is on the command line. And it's going to do the same thing. It loads... It has to do the same thing every time it parses. That's always identical. What happens at the end that's different is how it renders. So let's just look at index.txt. Okay, so it's trying to do as good as it can. It's still got things numbered, blank lines are where they should be. The characters are right, the quotes are right. The math it left like it was. So it just whatever was in the math that left it there, which I think that's probably the best decision you could make. And then the unordered list are asterisks and the numbered list, ordered list is the numbers, obviously. The math is there again, and the footnote is there at the end. Okay, and one last thing with this little simple file. We'll just use a dot book renderer. And what else to... Oh, there are three themes for dot book. And one is book, one is chapter, and one is article. This is an article. And if you don't use the right thing, you'll get invalid dot book. Oh, in the text. Good point. Okay, that's something that needs to be taken care of. Yeah, well, we try to keep them to a minimum. Okay, let's just take a quick look at that. XML mind is a, this version is a free XML reader and it knows dot book when it sees it. You can see up here it thinks, okay, this is dot book, stuff that I could do with it, I guess. And it's valid. There's a little mark here that says, yeah, it's okay. Of course, it's not very complicated, but it is valid. And let's see, there's something I wanted to show you, because I think it's kind of a neat idea that came from DB Latech, which is a way to go from dot book back to Latech. So if you were to, you can take this document and produce Latech back again from it. I'm just going to switch the view from their attempt at rendering dot book to something you can read to no style sheet. Okay, so the sentence was, it's good at typesetting mathematical formulas like, and we'll get an inline equation with an inline media object that is composed of two parts, an image object and a text object. The image object is obviously that ping we just created. The text object is the map, so we haven't lost the map. And if we process this with DB Latech, it'll find that tech source in the text object and reproduce the map in whatever format it's needed. So I think that's about all there is to say about that. And in the same thing for displayed map. Okay, well let's see. Oh yeah, the output directory that we've been filing these things to is right here. And if you're creating HTML, you see these CHMs, everybody know what a CHM file is? It's the Windows Compiled Help. And so you've got the files you need to create Windows Compiled Help along with the HTML. So you just feed these files into HTML Help Workshop, which is a free download from Microsoft, and you've got a Windows Compiled Help version of your document. And the same thing for Eclipse, if you're familiar with Eclipse Help or Java Help version 1 or 2, Kevin's created the auxiliary files you need just to feed that and then get that help in a browser, in a real application. And oh yeah, the main reason I changed this directory is this one right here. I made Plastic dump its internal representation. So I just wanted to show you what that looks like. Sample2e.xml, this is the way it looks to Plastic. So it's another well-formed XML file. It's got a namespace Plastic, and you can see what, make, title, everything, every element has an ID. So we've got paragraphs. And so everything is named, and let's see if there's anything interesting here to say. Title, it has a modifier, but the modifier is blank, so we could have had title star, I guess. And so everything in there looks somewhat like that. Everything is named, everything has an ID. So we can, when we're rendering this with a real template, it's not doing anything with this. I'm just showing you this to show you what it kind of looks like inside. But everything is named and everything has an ID, so we can get to each document. Okay, I wanted to show you a couple other things. This is a file that came from archive.org. And let's just take a look at what that does. This is, you know, a file from the wild. It's not sample2e.tech, so there's a little bit more involved. One thing I found on archive is that a lot of the papers there use revtech, a class that I didn't know about, and Plastic doesn't support. It looks like it would be easy to make it support it, but that's one reason I was having failures on a lot of papers from revtech. This particular one, I guess, used article in AMS math. So it's creating the math there. That'll take a second. And then we'll see what it looks like. But to be able to add a package or add a class, it's as simple as writing the Python statements, which are about as simple as what I was showing you before. You just subclass off something else and write a renderer. And that's it. Then you'll be able to parse that new class. As simple or as complex as you can do Python statements. Well, if I can do it, it's not that hard. Okay, so now we've got a paper, still an article. We've got our abstract and the table of contents. There's no reason to spend a lot of time on it, but you can see the citations are there. Those were real sites inside the file. The math is looking pretty good and it does the equation numbering outside. More math. And our breadcrumbs are going across the top, which is the default. And let's see, conclusions and discussion. So there are our bib items. These were actually put into the file as bib items. So we didn't have to make a bib tech run, but we could have to just go directly from the tech file and nothing else. Create bib tech in the interim. A big BBL file, I should say. And it looks like the titles are missing. Let's see what it looks like in the future. And chemistry as well. Yeah, these are the actual bib items. Don't recognize them, thank you. No, it's just all we ignorant. This is what it looks like inside the file. So it loaded article, AMS math and graphics. It did some stuff that we don't need to worry about. And then we just generated the whole thing. How are we doing on time? How do you have a table? Oh, like, nice. I can tell that you guys are mesmerized by this. This is another one that came out to, well, I'm not going to plastic it yet. I want to look at it. Because I had to do some tricks because I didn't know revtech before, but I knew I could see that I'm failing on preprint. I'm failing on PACS, email tag, affiliation and acknowledgments. So I just wanted to get this thing done. So I just made a new if, if plastic and set it to be false. So if I use this with latex or PDF latex, it's not going to pay any attention to all this stuff. It's just going to use revtech for like it did in the original. I added this block so that plastic is actually using this. It doesn't matter about the new if, plastic is going to ignore it. Plastic trick is always true when plastic is running. And so in that case, I decided, well, I don't know what to do. I think I'll just make preprint do nothing. I'll make a PACS, put things in text, small caps, make email be italic, affiliation, bold, centered, italic. And then this new environment acknowledgments. I just wanted to do a line break and put the word acknowledgments in small caps and then put the bolded text inside a quote environment. So I just did that in the preamble. So when plastic sees it, it'll be able to expand this and know what to do. So I didn't have to write a template to do this. If it's simple, you can just get away with latex code. If it's more complicated, like you're changing counters on a section or something like that, then you need to get back into the Python code. So a lot of things you can get away with, with this, but let's see if that's true. And EPS files, which I imagine might not look so good when we do this, but it'll convert them. I just don't think they'll look very good. Okay, so it's loading book and graphics. Okay, so we know that it's reading the right part. Otherwise, believe me, it would be choking if it was trying to rev-tech because it doesn't know what it is. Okay, creating more math. I'll make sure I'm covering everything. Internal done. No. Okay. Okay, and here this file is, and we've got our email address and italic, affiliation, okay, and our abstract and so forth. We'll just go through this rather quickly. We've got the sites are still working. Uh-huh. I think we'll make that one. Yeah. Oh, yeah? Page percent. Not that it mattered. This one? Yeah, didn't we lose like a couple of authors or something? Oh, yeah, we did. You guys are good. There is no system right now to put in every author. It just has room for more. It's a mistake. Also, the date is today. Does that mean that this particular article just had an empty date field or is there a mistake in the translation? That's a good question. I never had noticed that before. I don't think the draft is such a date. It doesn't use it. Let's just take a quick look at the, uh... Yeah, so he's just got into the fall book header, which probably has today in it. Yeah, I bet you're right. Oh, no, it's such a date. Date today, yeah. Good catch. Yeah, it's a good question. Yeah, I never thought about how that could mess you up. Are you a author, son? Yeah. Well, even in the evening, what are the pictures? Oh, the pictures, yeah. I knew you were going to ask that, because they're not very pretty. Yeah. They need to be converted to something better, you know, so... Wouldn't it take a lot of time? Well, I would assume that's what happened, is that Plastic converted using the Python image library from EPS to... Yeah, but is it possible to set up a resolution? It seems that if you just say, do it with high resolution, it will be better. Is it possible to configure different resolution? Not off the command line. I'm not sure about that. The EPS file is converted by Hashtag or Bbypng. Which one? No, it would be Plastic. Yeah, because if it's not in a math environment, if it isn't specified that, hey, go use Laytec, then... Why do resolutions use that? Python's probably thinking it needs to render for a web kind of resolution. Yeah, I don't know the... And you originally had me also quite that... Yeah, I never even looked at that. So, yeah, I'm not sure about that, but I think if it was a real project of mine, I would have a png to bring in instead. The only reason I'm lingering on this page is because of the acknowledgments environment that I set up with Laytec code. And Python's understood what to do with Plastic, I should say, put the acknowledgments in small caps. And then we've got a quote environment, and the text inside is bold. So, even though we changed what it did, Plastic understood it just from the Laytec code. Okay, and one thing that I wanted to do is to start my talk off with a command, but it slowed the machine down so much I knew that wasn't going to work. But I'll tell you why I was trying to far. I noticed that when you used the method in title for the header, the size was... Not so good, yeah. So, Plastic can control this one? I think you could, but you might have to make some changes to your tech file. I'm not sure because I don't even know what font they're using. But you could use... Right now, she's in computer modern, I think. But you could load any kind of font that you wanted to, or using Matime Pro, that'll come out as their images, but that's what's used to create the image. I think that if you put some input nodes, you will see it's too large. I have an impression that it just doesn't pick up the text size outside and just renders the market. It's difficult to hear for rendering is that the meaning of various levels of section headings is dependent on the client, not on the producer or the doctor. You really have to have control over that. Right, because we've lost context. Yeah. That's why you can't really do them all. You can make a default mapping with mind headings, the large, the couple of hours. But what might be worth looking at, however, is the simple math that has Roman letters that the limited set of re-quarters available in HTML, subscript, supercrit, you translate that to HTML. That would be good. That wouldn't be too hard. You're right. It's a simple string. When we were running... We don't recognize you give it a text. Exactly. And that's the way Kevin had things running at one time. But it says, we had complaints from the writers that they did not like to see it mixed. Because they'd have one equation that happened to work out in simple math, and the next one didn't. But they were supposed to be showing the similarities between these two with one difference. And it did look kind of odd that way. I downloaded the Python library reference. At one time, Python's documentation was all written in latex. So I just downloaded the whole thing, and I just said, plastic lib. And then 45 minutes later, which you see why I didn't do that, for my talk, we got the Python library reference. It made it all the way through. It didn't choke anymore. Some things could look better, but let's go through here. Take a look at... There we've got nested TOCs. Take a look at that. It looks okay. It could look better. But that was just using plastic and lib.tech, which fired up... All these tech files are just included into lib.tech. So for me, that was pretty impressive. 45 minutes, it didn't choke on anything. And I know it's standard latex. I mean, there isn't a lot of fancy stuff in there. But it did make it through, and we actually have a working library reference now. Okay. I think that's it. Thank you. I have a question. If there are two questions, actually, one, do you have any slides to support DocNet? I guess not, since I don't know what that is. Before that, we do Microsoft document format, but supposedly uses an open XML... Oh, right. Yeah, I know what we're talking about. If I need to write a paper and they will only accept it in Word, then... Yeah, I know what you're talking about. Actually, I get requests to have things put into RTF in Word, but it sounds... And I think the thing to do is go to DocBook, and then you can output RTF. And I would imagine you could open off his XML. Yeah, but what is Microsoft? Microsoft is still in the picture. Well, what are we supposed to do? I mean, what can you do? Well, yeah, but the question is probably the same on the... Yeah. Chris is going to ask you, can you do the... Looking at MathML converters... I'll just go to the email section a little bit more. I thought that MathML converters have you been looking at? No, well, I haven't spent much time looking at MathML converters, because I took a look at MathML renders, and until we have something that does a great job, not just an okay job, SAS doesn't want to mess with it, but of course we've got customers to please. And right now, I think... I don't know what the problem is with the Math as images. To me, it looks pretty good, unless you rescale it a lot. In which case, obviously it looks bad, but our customers, I don't think, have that expectation. No, that's the only problem there. Chris. We're coming back to... Thank you....usually quite in a different way. You're using this as a future documentation or just for paper? No, it's all the documentation. Online documentation. Online. That's right. It presumably has a lot of cross-references. Lots of cross-references. Bibliographies. Things to code and things like that. Listings, outputs, math. So you actually need the MathML, because you wanted to link the math to that stuff, but for some days, no? I want to change the MathML once it's a standard, yeah. Yeah. Yeah, definitely. I'm not against math. The next question is, do you know if the plastic people are working on... They're not working on a renderer. They would like to... A converter. Yeah, I'm sorry. That's what I meant, too. They're not working on that. That's why it's meant as a plug-in, so we can take expertise from people that are more expert. So, I mean... Well, you looked at TTH and... You went and asked, and all these other people who want to use plastic need to get together with them. They look... Somehow, we need to get a group together to do that. Well, I hear you, but we're customer-driven, and we aren't driven by that yet. I think we will be, but I don't think we're there yet. A renderer just looks horrible. Yeah, a lot of these things with customers, if they don't know it's possible, they don't know the answer to it. Well, but if you've seen the math with a... They don't know if you want to click on an equation and get it sent off to your SAS program or Mathematica or whatever. Well, that's neat, but I think we're concerned about how it looks as well, and so far, personally, I haven't seen anything that looks good. Let me take an example of the not-exactly-arrival to your... Okay....for the very similar or a validation map, where they have got all the documentation with these little links and maps, because they've got all the math and maps. And okay, yeah, the rendering is to be the problem, but don't indent it that way. That'll be great. Had a question? Comments? Yeah. You know, a comment that the DNM offers about two weeks ago. It had a publication of an article in research that was funded by Design Science... on approval for German students that went through every single facilitator from the back tool and the back mount in a very detailed way. It's a great thing. Yeah Nice I'm looking forward to reading them
to HTML, XML and other market languages. It's part of the publishing workflow to create our you a brief overview about where I'm coming from. package to load. It's an easy package to use. And saying specify how to handle math. Schematic, new macros, new commands, new environments, and for the documents I know I'm dealing with. But is the laytech sample file, and we get some It's a simple string. When we were running... We