Giter Club home page Giter Club logo

texlive.js's Introduction

texlive.js

This is a port of TeX live 2016 to Javascript. It is based on the port of the pdftex TeX compiler to Javascript using emscripten. It creates PDF files from LaTeX code and supports packages.

For more information checkout the wiki.

Related Projects

bibtex.js - bibtex ported to javascript ep_latex - etherpad-lite plugin for texlive.js

texlive.js's People

Contributors

manuels avatar fzimmermann89 avatar xylo04 avatar voltagex avatar chezbgone avatar mrshu avatar tcyrus avatar

Stargazers

waskito shidiq avatar 破晓帝 avatar oligami avatar Miguel Sarmiento avatar Wolf Oliver avatar kurayami avatar Jon Manning avatar QU, Tong avatar  avatar Yusuke Yasuda avatar wangwei avatar Jacob Hummer avatar Florian Krönert avatar tillo  avatar Anton Dubik avatar Hasith avatar AlexandreKempf avatar Michael Obvious avatar Rémi Marche avatar Nico Van Cleemput avatar  avatar  avatar SMR Mousavi avatar duli avatar Vedu Mallela avatar  avatar Ashwin Nayak avatar  avatar  avatar alvinary avatar summerBreeze630 avatar  avatar John avatar hiyori avatar  avatar CosliEye avatar Joona Kauppila avatar Alexander Mikuta avatar Nikita Dmitryuk avatar Matt Gleich avatar  avatar Siddhartha Basu avatar Huang Songlin avatar Matthew Nekirov avatar dà fǎ shī avatar Owen Rees avatar  avatar SelfMadeSystem avatar Jack avatar  avatar  avatar  avatar Zaú Júlio avatar yujonglee avatar Bruno Melo avatar IoTcat avatar  avatar Michał Cesarczyk avatar Luke Weiler avatar Amine avatar Alexander Greene avatar Masanori Ogino avatar Philippe Faist avatar Mihir avatar yizhe.wcm avatar Georgios Giatsidis avatar Samir Rashid avatar Andy Chou avatar Ben Zelnick avatar Johannes Schackniß avatar Killian avatar Aleksei Nurmukhametov avatar John Gosset avatar Ben avatar Boris Marin avatar  avatar Tahsin avatar  avatar  avatar Lehao Lin avatar Jeremy Vizzini avatar ebigram avatar Ismail Habibi Herman avatar Haosi Li avatar Saptarshi Dey avatar halulu avatar Shawn Charles avatar Chris Lin avatar Runchao Han avatar 立党 Lidang avatar  avatar Qi avatar  avatar Logan King (DarkComet) avatar  avatar Alfie Douglas avatar Simerl avatar Andrea PIERRÉ avatar Yunlu Zhao avatar lirizhong97 avatar

Watchers

 avatar Morten Wulff avatar Florian Gross avatar Ivan Savov avatar evandrix avatar Paul Dixon avatar Innovimax avatar Jim avatar roadlabs avatar Jens Axel Søgaard avatar Munehiro Yamamoto avatar Toshaan Bharvani avatar hamlet avatar timelyportfolio avatar James Cloos avatar Krister Kari avatar cfwings avatar Hao Sun avatar zhangaz1 avatar  avatar ahnan avatar Chii avatar Michael Anthony avatar Ryuichi Hayashi avatar Arun K. Subramaniyan avatar YOLO avatar hunter007 avatar  avatar  avatar Kresimir Mrsic avatar Tobi avatar Jacob Elstein avatar  avatar  avatar William Javier Trigos Guevara avatar  avatar Georg Felix Dues avatar Damian Junko avatar  avatar Kai Biermeier avatar  avatar  avatar  avatar Saptarshi Dey avatar  avatar

texlive.js's Issues

Client-side generated images

This is the future!

I would like to reference svg images that are generated in the browser. Is this somehow possible?

arabic or persian support

how can we use it to export proper pdf containing arabic or persian text?
for example consider following word: سلام

I used following code in sharelatex and it worked, but it showed errors with your library and the pdf was messed up:
\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[LFE,LAE]{fontenc}
\usepackage[english,farsi]{babel}
\begin{document}
سلام
\end{document}

by the way the error was this:
! LaTeX Error: Encoding scheme `LAE' unknown.

Consider adopting a less restrictive license

In reviewing my project's license compliance, I've been told that using texlive.js with GPL in my project requires that any other dependencies (in my case, Polymer and the Google JS API) also be made strictly GPL, which my company is unwilling to do. If there are no dependencies which require texlive.js to be GPL, would you consider changing to something else, perhaps LGPL? That would maintain the freedom and openness of texlive.js but also allow linking from non-GPL code.

How do I actually use texlive.js on my website?

Hey, sorry for the newbie question, but I'm having great difficulty actually understanding how texlive.js is integrated into a website.

All I've wanted to do is get the example at the top of the page working - I think I could take the rest from there. That is:

var pdftex = new PDFTeX();
var latex_code = "" + 
  "\\documentclass{article}" + 
  "\\begin{document}" + 
  "\\LaTeX is great!" + 
  "$E = mc^2$" + 
  "\\end{document}"; 

pdftex.compile(latex_code)
      .then(function(pdf) { window.open(pdf) });

I've tried downloading the zip file of the github project, running index.html locally, then running 'compile this latex document' and get an error about difficulty establishing a web worker.

I've tried using (what I thought were) the main scripts of this project, i.e., promise.js, pdftex.js, and pdftex-worker.js, and then running the above code but that didn't work either.

What am I missing here? Is emscripten required to get texlive.js up and running? Is there a backend aspect to texlive.js that I'm completely missing? My understanding is that everything in this project is client-side, so shouldn't it be possible to throw up all the files in the project on my server, load up the index.html, then insert the above code in the console and have a tab pop open with the 'LaTeX is great!' pdf?

Thanks for any help!

Help for a beginner?

Hello everyone,

I'm creating a web where I would like to generate pdf files from latex format, and I thought that texlive.js would be useful for this purpose but I'm not able to make it work.

At the moment, I have only been able to download the files on my computer and run the index.html (like http://manuels.github.io/texlive.js) with Mozilla (when I use Chrome it doesn't work). However, when I copy the files and folders (with the same structure) to my server I can load the main page (index.html) but once I push the "Compile this LaTeX code to a PDF" button, in the "console output" appears the message "Compiling", but keeping in this state for the eternity.

Any ideas about what I could be doing wrong? Some suggestions for the beginners would be welcome ;) Thanks,

Maki.
PD: Sorry for my English mistakes, but I'm from Spain and my language skills aren't the best ones.

WIP - compiling with 1.34

Hi,
I would like to rebuild the, but get errors as in #14, so pdf-worker doesn't build with the current version of emscripten, or does it? What is the latest version anyone has used to compile it?

Thank you
Felix
btw: the demo page ist broken because of some memory problem truncating the pdftex.map file (#1 )

begriff

pdftex cannot compile begriff's commands as for example:

$\BGassert\BGconditional{a}{\BGconditional{b}{a}}$

It is needed to compile using pdflatex

latex.fmt doesn't match pdftex.pool

When trying to create a pdf file I get this error:

This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
 restricted \write18 enabled.
---! //texmf-var/web2c/pdftex/latex.fmt doesn't match pdftex.pool
(Fatal format file error; I'm stymied)

The latex.fmt file itself appears to be fine, the exemplary index.html runs well with texlive.js in its own directory... when I want to use it in my project, it won't work though. Guess it is some weird directory structure or filesystem problem then. From the networking tab of Firefox's devtools I can see that the latex.fmt is requested and received properly, very strange thing. Maybe someone has an idea?

PGFPlots and needing to expand the available memory

Absolutely brilliant idea this, having texlive as a javascript module - magic!

I've managed to configure several packages (float, titling, caption) into this with great result.

Process to add package:

  • Grab .tds.zip of package from CTAN
  • Unzip the .tds.zip package to ./texlive/texmf-dist/
  • Update ./texlive.lst and ./texlive/texmf-dist/ls-R by running the following (I have this saved as bash .sh file in the ./ directory)
find texlive -type d -exec echo {}/. \; | sed 's/^texlive//g' >texlive.lst
find texlive -type f | sed 's/^texlive//g' >>texlive.lst
cd texlive/texmf-dist/
ls -R -1 > ls-R

That all seems to work fine. Now the issue is in trying to get pgfplots to run.

Process to configure pgfplots:

  • Download pgfplots.tds.zip from CTAN
  • Extract contents to ./texlive/texmf-dist/
  • Run above script to update ./texlive/texmf-dist/ls-R and ./texlive.lst.
  • Test in web browser.
  • It lists missing files (tikz.sty which belongs to the pgf package)
  • Repeat this process with pgf.tds.zip from CTAN
  • More dependencies (everyshi.sty which belongs to the ms package)
  • Repeat this process with ms.tds.zip from CTAN
  • More dependencies (xcolor.sty which belongs to xcolor package)
  • Repeat this process with xcolor.tds.zip from CTAN
  • All dependencies met huzzah!

Problems:

Here's the compile log...

analysis.php:221 This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
analysis.php:221 restricted \write18 enabled.
analysis.php:221 entering extended mode
analysis.php:221 (./input.tex
analysis.php:221 LaTeX2e <2015/10/01> patch level 1
analysis.php:221 (//texmf-dist/tex/latex/base/article.cls
analysis.php:221 Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
analysis.php:221 (//texmf-dist/tex/latex/base/size10.clo))
analysis.php:221 (//texmf-dist/tex/latex/tools/array.sty)
analysis.php:221 (//texmf-dist/tex/latex/caption/caption.sty
analysis.php:221 (//texmf-dist/tex/latex/caption/caption3.sty
analysis.php:221 (//texmf-dist/tex/latex/graphics/keyval.sty)))
analysis.php:221 (//texmf-dist/tex/latex/fancyhdr/fancyhdr.sty)
analysis.php:221 (//texmf-dist/tex/latex/graphics/graphicx.sty
analysis.php:221 (//texmf-dist/tex/latex/graphics/graphics.sty
analysis.php:221 (//texmf-dist/tex/latex/graphics/trig.sty)
analysis.php:221 (//texmf-dist/tex/latex/latexconfig/graphics.cfg)
analysis.php:221 (//texmf-dist/tex/latex/pdftex-def/pdftex.def
analysis.php:221 (//texmf-dist/tex/generic/oberdiek/infwarerr.sty)
analysis.php:221 (//texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
analysis.php:221 (//texmf-dist/tex/latex/float/float.sty)
analysis.php:221 (//texmf-dist/tex/latex/geometry/geometry.sty
analysis.php:221 (//texmf-dist/tex/generic/oberdiek/ifpdf.sty)
analysis.php:221 (//texmf-dist/tex/generic/oberdiek/ifvtex.sty)
analysis.php:221 (//texmf-dist/tex/generic/ifxetex/ifxetex.sty))
analysis.php:221 (//texmf-dist/tex/latex/pgfplots/pgfplots.sty
analysis.php:221 (//texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex)
analysis.php:221 (//texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty
analysis.php:221 (//texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
analysis.php:221 (//texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
analysis.php:221 (//texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex))
analysis.php:221 (//texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
analysis.php:221 (//texmf-dist/tex/latex/ms/everyshi.sty))
analysis.php:221 (//texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex))
analysis.php:221 (//texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
analysis.php:221 (//texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
analysis.php:221 (//texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex))
analysis.php:221 (//texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg)
analysis.php:221 (//texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def
analysis.php:221 (//texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def)))
analysis.php:221 (//texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex))
analysis.php:221 (//texmf-dist/tex/latex/xcolor/xcolor.sty
analysis.php:221 (//texmf-dist/tex/latex/latexconfig/color.cfg))
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex
analysis.php:221 ))) (//texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex))
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex))
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex)))
analysis.php:221 (//texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex)
analysis.php:221 (//texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex)
analysis.php:221 (//texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty)
analysis.php:221 (//texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty))
analysis.php:221 (//texmf-dist/tex/latex/pgf/utilities/pgffor.sty
analysis.php:221 (//texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
analysis.php:221 (//texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex))
analysis.php:221 (//texmf-dist/tex/latex/pgf/math/pgfmath.sty
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmath.code.tex))
analysis.php:221 (//texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
analysis.php:221 (//texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
analysis.php:221 (//texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex)
analysis.php:221 Runaway argument?
analysis.php:221 {badness wa
analysis.php:221 ! TeX capacity exceeded, sorry [main memory size=250000].
analysis.php:221 <argument> badness war
analysis.php:221                       nings for centered text/.is if
analysis.php:221 l.1093 ...xt/.is if=tikz@warn@for@narrow@centered}
analysis.php:221                                                   
analysis.php:221 !  ==> Fatal error occurred, no output PDF file produced!
analysis.php:221 Transcript written on input.log.

Attempted solutions:

  • It might be a memory problem? PGFPlots is apparently quite a memory intensive package and there's the error message ! TeX capacity exceeded, sorry [main memory size=250000]. in the log.
  • First attempt is that from the wiki which suggests changing the pdftex.set_TOTAL_MEMORY(memsize_in_bytes) so here's my javascript call to compile.
pdftex.set_TOTAL_MEMORY(512*1024*1024).then(function() {
    pdftex.FS_createLazyFile('/', 'carne.jpg', '../../images/carne.jpg', true, true);
    pdftex.FS_createLazyFile('/', 'histogram.png', document.getElementById("month-canvas").toDataURL(), true, true);
 	pdftex.on_stdout = logCompilation;
  	pdftex.on_stderr = logCompilation;

	pdftex.compile(sourceCode).then(function(pdf) { 
        showCompilingIndicator(false);
		if (pdf) { //pdf === false
			window.open(pdf);
		}
	});
});
  • Note that I set use pdftex.set_TOTAL_MEMORY(512*1024*1024) which is a ridiculously large number and it doesn't change the result
  • Googling points to modifying the ./texlive/texmf.cnf file and adding memory parameters so I try something like this (again with large values), this is my ./texlive/texmf.cnf file
% (Public domain.)
% This texmf.cnf file should contain only your personal changes from the
% original texmf.cnf (for example, as chosen in the installer).
%
% That is, if you need to make changes to texmf.cnf, put your custom
% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than
% the distributed file (which is .../texlive/YYYY/texmf-dist/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
%
TEXMFLOCAL = $SELFAUTOPARENT/texmf-local
TEXMFVAR = /home/thunder/emsdk_portable/texlive.js/home/texmf-var
main_memory=1000000000
extra_mem_bot=4000000
font_mem_size=1000000
pool_size=6000000
buf_size=6000000
  • I've added the main_memory, extra_mem_bot, font_mem_size, pool_size and buf_size variables.
  • Attempted playing around with the values and some configurations result in the Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 67108864, or (2) set Module.TOTAL_MEMORY before the program runs. error message (regardless of my pdftex.set_TOTAL_MEMORY call)
  • You can somewhat arbitrarily change the values up and in this particular configuration attempting to compile results in the following log:
...
analysis.php:221 (//texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex)
analysis.php:221 Runaway argument?
analysis.php:221 {badness wa
analysis.php:221 ! TeX capacity exceeded, sorry [main memory size=4250000].
analysis.php:221 <argument> badness war
analysis.php:221                       nings for centered text/.is if
analysis.php:221 l.1093 ...xt/.is if=tikz@warn@for@narrow@centered}
analysis.php:221                                                   
analysis.php:221 !  ==> Fatal error occurred, no output PDF file produced!
analysis.php:221 Transcript written on input.log.
  • Investigated ./texlive/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex, deleting or modifying this in any way (ie shortening it so that it doesn't occupy so much memory) results in the same error, only after the next file in the sequence that it needs to fetch to compile.
  • According to this post you should after altering the texmf.cnf run some kind of utility called texhash to populate sub-dependent files to actually fully configure the memory changes. My issue is calling texhash alters the local install, not the texlive.js folder I don't know what subchanges are actually needed! Similarly this post suggests similar but with fmtutil needing to be called - same issue, I don't know how to call this on the texlive.js directory.

Conclusions

I don't think anything I've done has impacted the available memory to the compiler, even though I've been able to alter the [main memory size=250000] to [main memory size=4250000] in the logs (which is 17 times larger) I think this is just a misreporting or I'm not altering the right kind of memory (number of strings, etc). Any ideas?

Package Fitch

I have been successful in including the package fitch in texlive.js:

fitch: [
['texlive/texmf-dist/tex/latex/fitch/fitch.sty', '/', 'fitch.sty']
],

I had to download fitch.sty in: http://www.mathstat.dal.ca/~selinger/fitch/ and to create the folder "fitch" in ../texlive/texmf-dist/tex/latex. The document compiled:

Uploading Captura de tela de 2013-01-26 22:04:38.png . . .

But, I cannot compile the document twice, because I guess there is a bug

Uploading Captura de tela de 2013-01-26 22:06:46.png . . .

Utf8

Hello there,
It seems like utf8 isn't supported well. All of special characters ěščřžýáíéúů (and similar) in czech language aren't interpreted by texlive.js I use \usepackage[utf8]{inputenc} with this error:

Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding `utf8'.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                                                                          
l.27 Y~￀�

         ᭩ﻀ�

either usage of latin2 doesn't help much altough few of characters are ok, but not all and similiar error:

! Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding `latin2'.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                                                                            
l.26  ^^[
         a

I tried this strace -e open pdflatex yourfile.tex 2>/tmp/required_files mentioned in arabic issue but it exited with 0, without the -e open option the file is quite long and messy for me.

Can anyone help me with utf8 setting?

PSTricks

Its possible render PSTricks pictures?

Font file missing in demo

demo prints

LaTeX Font Warning: Font shape `OMS/cmr/m/n' undefined
(Font)              using `OMS/cmsy/m/n' instead
(Font)              for symbol `textbraceleft' on input line 98.

Obviously one more file has to be imported into the virtual filesystem of emscripten to make the italic font work correctly.
Which file is it?

png images

can texlive.js produce png images as output?

Licence ?

I would like to use texlive.js in a commercial web-app.

Am i allowed to use it ?

bibtex / biblatex / citation support

I've been toying with getting this to work with some of my existing latex documents thus far and have had good success with copying in the relevant files and pointing texlive.js to them. A major roadblock however is going to be BibTeX. I've been using latex-mk and the compile sequence is a nasty combination of latex bibtex latex bibtex etc. However I see there is such a thing as biblatex. I'm not familiar with it so I thought I would ask if you see any roadblocks. Obviously the biber backend cannot be used since it is written in perl, but it seems that it would provide basic citation support nevertheless.

Alternately, bibtex is also written in WEB, so could presumably compiled to javascript as well.

Automatic file inclusion

idea:

download files automatically when a certain package is included.
needed: search latex code for lines with \usepackage and lookup in a list the files to include.

pdftex.js and pdftex-worker.js must be placed in root

Attempting to use texlive.js as a library without modification and also placing it in a vendor folder are currently not possible, because this line in pdftex.js:

var worker = new Worker("pdftex-worker.js");

seems to be relative to root. If possible, I'd like to see if that can be made relative to the calling script. As an alternative, perhaps the content of pdftex-worker.js can be inlined in pdftex.js.

Getting ' Uncaught Error: No such file or directory' error on server

Hi,
This is a great library! I'm having a little trouble getting is working on my server. The page I've got setup works fine on my local dev machine but on the server I get the following error:

pdftex-worker.js:formatted:1713 Uncaught Error: No such file or directory
lookup @ pdftex-worker.js:formatted:1713
lookup @ pdftex-worker.js:formatted:2857
Z @ pdftex-worker.js:formatted:2553
B @ pdftex-worker.js:formatted:2494
X @ pdftex-worker.js:formatted:2860
create @ pdftex-worker.js:formatted:2876
nd @ pdftex-worker.js:formatted:3538
nc @ pdftex-worker.js:formatted:3711
k.onload @ pdftex-worker.js:formatted:33
aa @ pdftex-worker.js:formatted:41
self.onmessage @ pdftex-worker.js:formatted:91

Watching the network trace, it downloads the texlive.lst file fine but no network requests are made after that. Running in Chrome, network tab doesn't show any request after the texlive.lst. I can also verify that in the webserver logs. So it seems like something goes wrong after that file download but before any of the other files are downloaded. Any thoughts?

Thanks
Fred

Is xeLaTeX supported?

I understand several years ago this question had been asked, and Manuels said maybe they would make a xeLaTeX js in the future. Can I ask when will we have it? I am really in a desperate need of xeLaTeX.

adding a style while compiling

In texlive the Unix version it is possible to add a cls file which contain a certain style to the tex document and the result is the pdf with styles represented
Does texlive .js provide the same function

How to get this to work with Microsoft IIS (express)?

Hi,

title pretty much says it all. I cloned the repo and I cannot get the index.html to work. Apparently its pretty normal for it not to work from the filesystem, so I put it in an IIS Express, but I still run into an error everytime, even with the minimum example:

var pdftex = new PDFTeX();
var latex_code = "" +
"\documentclass{article}" +
"\begin{document}" +
"\LaTeX is great!" +
"$E = mc^2$" +
"\end{document}";
pdftex.compile(latex_code).then(function() { console.log("asd"); })

I get:

Promise {_callbacks: Array[0]}_callbacks: Array[0]proto: Object
pdftex-worker.js:1480 Uncaught Error: No such file or directory

lookup @ pdftex-worker.js:1480
lookup @ pdftex-worker.js:1509
Z @ pdftex-worker.js:1502
B @ pdftex-worker.js:1500
X @ pdftex-worker.js:1509
create @ pdftex-worker.js:1510
nd @ pdftex-worker.js:1530
nc @ pdftex-worker.js:1536
k.onload @ pdftex-worker.js:2
aa @ pdftex-worker.js:2
self.onmessage @ pdftex-worker.js:4

I noticed that clicking the button on the github.io site, over 100 network requests are made, while my local iis site only does like 26 and then throws the error.
I configured my iis to serve all filetypes from the .lst files and it does serve them.
It seems to be an issue with the virtual filesystem not creating anything.
Im totally lost on how to continue debugging. I feel like the server settings actually should not interfere in javascripts execution too much, but I cannot think of any other error. I tried to compile it myself on a xenial ubuntu with --minify 0, but it gets stuck somewhere on the way (Im not great at compiling stuff), so I also dont have an unminified version of the worker.
Anyway, I feel like this might actually be easy to fix with some experience (which I dont have a lot of sadly), so I figured Id just ask here. Maybe its just a weird path issue.

LaTex Code Compilation

I have an editor designed in my project and now I want to compile the LaTex code written in the editor.
Please tell me what packages may I include and how??

Build fails due to non-existent directories in pdftex

I attempted to build texlive.js by starting up this docker container, then executing these commands inside the git repo

apt-get update
apt-get install git llvm default-jre wget unzip texinfo texlive-latex-base texlive-fonts-recommended texlive-fonts-extra

git submodule init
git submodule update

make

ultimately running into this error
img-2017-04-29-103603
Executing this command

mkdir -p ./binary/pdftex-1.40.11/build-pdftex/texk/web2c/pdftex

gets me past the first error eventually (only when executed in a specific order like make clean && mkdir ... && make) but the second one still makes it fail.

I somehow got it to installing all texlive packages but then again same story. The very same directory disappeared and the pdftex worker does not get built.
img-2017-04-29-104912

I'm running emscripten 1.37.10.

shared:ERROR: closure compiler failed (rc: 1)

Every time I try to compile, closure compiler throws an error:

/tmp/emscripten_temp_vx7x3kzq/pdftex-worker.bc.o.js.pp.js.mem.js.jso.js.jso.js.jso.js.jso.js:1: ERROR - Variable Module declared more than once. First occurrence: /tmp/emscripten_temp_vx7x3kzq/pdftex-worker.bc.o.js.pp.js.mem.js.jso.js.jso.js.jso.js.jso.js

Any possible solution to this?

Texlive 2012? 15? 16?

Hey,
what is a bit confusing about this package is what version of texlive this really refers to. I can see that the README has been updated to say 2016, but nothing else has, right? So I assume that this is really the 2012 version. if that is the case, could this be stated clearly in the README?

Or is part of this code dump? This file seems to have been minified. Is there a source version of it anywhere: 48fca04

Missing packages -- how to add them?

When I call \usepackage{...} with some fancier packages, it usually fails due to a missing file.

Examples: tabu.sty, booktabs.sty, xcolor.sty, setspace.sty, changepage.sty, url.sty

I think this wiki section is there to help. But I still have some open questions:

Do I need to compile something with emscripten whenever I want to add new packages?

Or is it enough if I just add the original .sty files to texlive/texmf-dist/tex/latex/ and then add the filename to supported_packages in website/texlive.js?

Can someone who has successfully added packages help? Thanks!

compilation fails the second time

I go to the github project page. I follow the link to the website. I compile. Works great-- you are great!

I compile again, with or without changing the input text. It never returns.

When I try it on my home machine I get an error that I do not understand pointing to the first line of the webworker.js file. Sorry; I don't know enough js to fix it myself.

Jim

Compiling pdftex-worker.js fails - Part 2

Following on from issue #13, there is a second, similar, error.

Environment

As in issue #13.

Issue

After applying my suggested fix for #13, the compilation still only gets as far as llvm-linking in the make pdftex-worker.js task (Line 112 of Makefile) and then fails with the following error:

/home/username/llvm32build/bin/llvm-link: link error in 
'/home/username/.emscripten_cache/libc.bc': Linking globals named 'opterr': symbol 
multiply defined!

Cause

Unlike issue #13, this error is in linking the emscripten libc library. Investigating with llvm-nm reveals that kpathsea/libkpathsea_la-getopt.o exports this symbol.

Workaround

It is hard to propose a 'fix' for this problem. We probably can't exclude the file as we did in #13, because it is genuinely part of the kpathsea library. Instead my personal workaround is to comment out line 1441 from ~/emscripten/emcc and then force a rebuild of the cache of libc.bc by running:

rm ~/.emscripten_cache/libc.bc

After applying this fix, along with my proposed solution to issue #13, texlive.js compiles successfully.

I'm not sure whether this should really be considered an issue with texlive.js or with emscripten - it's really just an incompatibility between the two.

Warning

Using more recent versions of emscripten than 1.8.2 makes things even worse. See their commit on 17th Nov 2013.

Can't make on mac - Solution

Hi,

I'm playing around with the code on my mac, and I couldn't pdftex to compile initially because of some encoding errors.

I was able to fix them by adding these settings to my bash session (you can read about the issue here):

export LC_CTYPE=C
export LANG=C
I can send you a pull request if you think they would make a good addition to your makefile. Otherwise, I hope helps anyone else who comes across the same problem.

Minor path issue

Line 155 of pdftex.js:

curry(self, 'FS_createLazyFilesFromList', ['/', 'texlive.lst', './texlive/', true, true]),

This produces paths with double slashes in them, e.g., /texlive//texmf.cnf

Many web servers will merge consecutive slashes in an URL so this doesn't cause a problem (I think Apache does this by default, actually, at least mine does), but some don't. For example, Amazon S3 doesn't merge slashes.

Changing the line to:

curry(self, 'FS_createLazyFilesFromList', ['/', 'texlive.lst', './texlive', true, true]),

(trailing slash removed from '.texlive/')

makes the example code work when served out of Amazon S3 without breaking the code for Apache (again, based on my Apache install).

Compatibility Table

Hi!
@manuels Thanks for making this library :)

I was curious to know what things of texlive are not supported in texlive.js.
For example, are the following supported:

  • custom fonts
  • including png, ps images
  • normal bibtex support
  • custom classes (+ how to load them, for example for using a specific page layout and fonts)

Could you please create an examples page, similar to the one you created for hpdf.js? That would indeed help a lot with the above.

Thanks!

XeLaTeX

Is it possible that you make a js version of xelatex as well? I work with bidirectional documents that can't be compiled properly with pdftex.

PDF-file doesn't open

Thanks for creating texlive.js, it's great!

There is one problem: It doesn't work on Chromium under Ubuntu 14.04. The compiling seems to work, but the PDF is not opened. Instead, "Cannot GET /false" is displayed".

Compiling pdftex-worker.js fails

I run into an interesting problem when trying to compile pdftex-worker.js from scratch, by cloning texlive.js and running make.

Environment

Issue

When running make, the compilation gets as far as llvm-linking in the make pdftex-worker.js task (Line 112 of Makefile) and then fails with the following error:

/home/username/llvm32build/bin/llvm-link: link error in 
'/tmp/tmpIRh25X/access_15.o': Linking globals named 'main': symbol 
multiply defined!

Cause

This error happens because access_15.o does have a main method, even though it is part of the kpathsea library. This can be verified by running llvm-nm access.o:

U access
U exit
U fprintf
U fputs
T main
U printf
U stderr
U stdout
U strcmp

At which point in becomes clear that access.c is not intended to be part of the library, rather it produces a standalone executable when compiling kpathsea.

There are many such files in both kpathsea and web2c, any of which will cause the build to fail in the same way.

Potential Solution

In order to compile successfully, we need to exclude all object files from these two libraries that contain a main method, because these are clearly not library modules, they are standalone executables. This can be done with some bash magic, as seen in my commit.

I would be happy to submit that commit as a pull request if you think it would be useful. I suspect this whole issue has only arisen because the behaviour of emscripten has changed since @manuels last updated.

Warning

Even after applying this fix, texlive.js will still not successfully compile with emscripten 1.8.2. See issue #14 for details.

This library requires TEXLIVE distribution installed on the computer to be used?

Hi,

I need to develop a LaTeX web application program in Java that compiles LaTeX documents without the need of making external communication with other process, so the main requirement of this application is not having TEXLIVE (or another distribution) installed on the computer where the program is going to be executed. This library requires TEXLIVE distribution installed on the computer or it can work without any dependency?

Thanks.

media9 plugin

Hello,

I am trying to get media9 package to work in order to produce media PDFs through the the webserver.

Is it possible to use the media9 plugin in texlive.js ?
Mine isnt working.

Just saying:

...
! LaTeX Error: File `media9.sty' not found.
...

And I added the following to texlive.js:

media9: [
['texlive/texmf-dist/tex/latex/media9/media9.sty', '/', 'media9.sty']
],

Any suggestions ?
Thank you very much for any kind of response!

/edit
i think this is the problem:
[quote]
To use packages in texlive.js, the corresponding package file must be downloaded before compilation, otherwise pdftex will not be able to find these files.
[/quote]

but how to compile on my own using windows ?

Server configuration sensitivity

I'm having luck running my app and compiling TeX on my localhost using the node.js http-server, but in other server configurations (python SimpleHTTPServer, Google App Engine), I tend to get errors like:

Runaway definition?
->\let \@oddfoot \@empty \def \@oddhead { 
! File ended while scanning definition of \ps@headings.
<inserted text> 
                }
l.2 

)
Runaway definition?
->\let \@oddfoot \@empty \def \@oddhead { }\let \@unprocessedoptions \ETC.
! File ended while scanning definition of \ps@headings.
<inserted text> 
                }
<*> &latex input.tex

! Emergency stop.
<*> &latex input.tex

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on input.log.

Or sometimes:

/bin/this.program: fatal: Could not undump 1 4-byte item(s) from latex.fmt.

This second one is seemingly fixed if I clear my browser's cache. Based on that, I feel like maybe it's a header issue, maybe encoding, but I'm not sure.

Are you aware of any server configuration tricks that need to be addressed for texlive.js to work properly?

Performance

The implementation is really nice but performance wise it's just bad. Loading all package files synchronous takes about 100ms per file which adds up quite fast. My local compiling takes about 4 seconds. Texlive.js takes 80 seconds.

Is there any solution to preloading necessary files or loading all files asynchronously?

In my usecase I know 100% of the packages pre compiling of the tex file.

Maybe @manuels or @fzimmermann89 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.