TeX Filter doesn't work

TeX Filter doesn't work

Михаил Волобой -
回帖数:10

The version of my moodle-site is Moodle 3.5 (Build: 20180517).

I have TeXLive installed on server, but TeX filter doesn't work. Here is TeX Filter Debugger report:

3. /site/public_html/filter/tex/mimetex.linux: 1: /site/public_html/filter/tex/mimetex.linux: Syntax error: word unexpected (expecting ")") 
The shell command
"/site/public_html/filter/tex/mimetex.linux" -e "/site/moodledata/filter/tex/9608176195573c30c6beb3cf078fdf66.gif" -- '\Large f(x)=\int_{-\infty}^x~e^{-t^2}dt'
returned status = 2
File size of mimetex executable /site/public_html/filter/tex/mimetex.linux is 1317676
The file permissions are: 100755
The md5 checksum of the file is be9326dfd98c19c55b37beb1acc132c7
Image not found!

4. nothing (blank box)

5. latex executable (/site/public_html/latex/bin/x86_64-linux/latex) is readable
dvips executable (/site/public_html/latex/bin/x86_64-linux/dvips) is readable
Error: convert executable () is not readable
dvisvgm executable (/site/public_html/latex/bin/x86_64-linux/dvisvgm) is readable

base filename for expression is '9608176195573c30c6beb3cf078fdf66'

Processing TeX expression: f(x)=\int_{-\infty}^x~e^{-t^2}dt
$ '/site/public_html/latex/bin/x86_64-linux/latex' --interaction=nonstopmode --halt-on-error /site/moodledata/temp/latex/9608176195573c30c6beb3cf078fdf66.tex
OUTPUT: This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode

(/site/moodledata/temp/latex/9608176195573c30c6beb3cf
078fdf66.tex
LaTeX2e <2018-04-01> patch level 5

(/site/public_html/latex/texmf-dist/tex/latex/base/ar
ticle.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class

(/site/public_html/latex/texmf-dist/tex/latex/base/si
ze12.clo))
(/site/public_html/latex/texmf-dist/tex/latex/base/in
putenc.sty
(/site/public_html/latex/texmf-dist/tex/latex/base/la
tin1.def))
(/site/public_html/latex/texmf-dist/tex/latex/amsmath
/amsmath.sty
For additional information on amsmath, use the `?' option.

(/site/public_html/latex/texmf-dist/tex/latex/amsmath
/amstext.sty
(/site/public_html/latex/texmf-dist/tex/latex/amsmath
/amsgen.sty))
(/site/public_html/latex/texmf-dist/tex/latex/amsmath
/amsbsy.sty)
(/site/public_html/latex/texmf-dist/tex/latex/amsmath
/amsopn.sty))
(/site/public_html/latex/texmf-dist/tex/latex/amsfont
s/amsfonts.sty)
(/site/public_html/latex/texmf-dist/tex/latex/amsfont
s/amssymb.sty)
(/site/public_html/latex/texmf-dist/tex/latex/base/la
texsym.sty) (./9608176195573c30c6beb3cf078fdf66.aux)
(/site/public_html/latex/texmf-dist/tex/latex/amsfont
s/umsa.fd)
(/site/public_html/latex/texmf-dist/tex/latex/amsfont
s/umsb.fd)
(/site/public_html/latex/texmf-dist/tex/latex/base/ul
asy.fd) [1] (./9608176195573c30c6beb3cf078fdf66.aux) )
Output written on 9608176195573c30c6beb3cf078fdf66.dvi (1 page, 496 bytes).
Transcript written on 9608176195573c30c6beb3cf078fdf66.log.
RETURN CODE: 0
$ '/site/public_html/latex/bin/x86_64-linux/dvips' -E /site/moodledata/temp/latex/9608176195573c30c6beb3cf078fdf66.dvi -o /site/moodledata/temp/latex/9608176195573c30c6beb3cf078fdf66.ps
OUTPUT: 
RETURN CODE: 0
$ '/site/public_html/latex/bin/x86_64-linux/dvisvgm' -E /site/moodledata/temp/latex/9608176195573c30c6beb3cf078fdf66.ps -o /site/moodledata/temp/latex/9608176195573c30c6beb3cf078fdf66.svg
OUTPUT: 
RETURN CODE: 0

Another information: .tex and .ps files in temp/latex folder contains what they should contain, but .svg file is white and empty.

And when I try to do the last command from a command line I get next information:

processing file /site/moodledata/temp/latex/9608176195573c30c6beb3cf078fdf66.ps  
WARNING: file '/site/moodledata/temp/latex/96081761955  73c30c6beb3cf078fdf66.ps' not found in special 'psfile'  graphic size: 100.375pt x 18.0675pt (35.277778mm x 6.35mm)                       output written to   ../../moodledata/temp/latex/9608176195573c30c6beb3cf078fdf66.svgfile converted in 0.195008 seconds
I hope someone could help me with this problem. Thank you!
回复Михаил Волобой

Re: TeX Filter doesn't work

Ken Task -
Particularly helpful Moodlers的头像

Not sure I can help with all ... but a question or two ...

First ... the /filter/tex/mimetex.linux executable does come with the Moodle package.

I tested with a 3.5 on Linux CentOS standalone server ... no public_html ... but from /var/www/html/moodle35/ and your command:

/filter/tex/mimetex.linux" -e "/site/moodledata/filter/tex/9608176195573c30c6beb3cf078fdf66.gif" -- '\Large f(x)=\int_{-\infty}^x~e^{-t^2}dt'

did execute but I had to manually create 'filter' and 'tex' directories and set ownerships permissions to web server user for CentOS 7 before the 9608176195573c30c6beb3cf078fdf66.gif file was created.

Your site is running in a public_html directory ... those are normally used on shared hosting and restricted (not really a very friendly place for version 3's of moodles).   Are you on a shared host?

Also ... latex executable (/site/public_html/latex/bin/x86_64-linux/latex) is *not* part of Moodle core code and am un-aware of any addon plugin for latex that would install /latex/bin/x86_64-linux/latex.    So where did it come from?

In your $5: Error: convert executable () is not readable

Think that would cause the rest of it to fail.

And, thought TexAlive basically replaced latex altogether ... at least that's true on CentOS 5,6,and 7 I think.

Which Linux are you running?

'spirit of sharing', Ken


回复Ken Task

Re: TeX Filter doesn't work

Михаил Волобой -

Yes, unfortunately my site is hosted and it is not my real server or a virtual server - just host. 

The OS is Ubuntu 12.04.5 LTS. 

Since this is hosting, as you can imagine, I don't have any access to usual Linux directory (like /usr/bin/...), instead of that I have just folders with sites fils inside. For example, for this site I have a folder ''site", contains "moodledata" and "public_html". 

Since I haven't access to /usr/bin/..., I decided to instal TeXLive inside of "/site/public_html". I created a new folder "latex": /site/public_html/latex and during the installation process of TeXLive I have chosen "/site/public_html/latex" path to installation instead of standard " /usr/bin/...".  That's why (/site/public_html/latex/bin/x86_64-linux/latex) looks so strange.

And this is a reason why Convert executable () is not readable - I don't have an access to this file if it exists not in my folders.

Now I just try to understand why .tex, .dvi, .ps, .log, .aux files "creates" normally, but .svg is white-blank.

Maybe you know what should I try more to find the reasons of my problem? For example, could you suggest me what permissions should I give for any files?

Thank you for your help!

回复Михаил Волобой

Re: TeX Filter doesn't work

Ken Task -
Particularly helpful Moodlers的头像

So we're having a go at 'hack the hosted box'.   First, think I'd check into policies of the company that host it .... the fine print.   What you are attempting to do might be grounds for hosting company to cut you off from your own accounts.

I'd get a full backup of the moodle ... tar ball of code, tar ball of moodledata, and an SQL dump of the DB for moodle and download those.

Comment: Ubuntu version is way outta date if it is truely Ubuntu 12.04.5 LTS ...  isn't it?

So Visvanath might be correct ... the error in attempting to do the second thing cannot find 'convert' ... part of imagemagik.   So how did you install the TexAlive?  If you installed a pre-complied binary one might not be able to change paths for something to look else where for supports.

However, let's see about ownerships/permissions ....  check the mimetex.linux file ownerships/permissions ... set the latex x's the same way.   If that doesn't help ... or get you further down the road to hacking the box ... you might check with hostng company about a VPS and Ubuntu 16.04 LTS to move your site to!

In my past, used to venture into areas such as this for fun ... it never ended well ... and never had anything 'on hack the box type' servers I cared about NOT losing.   Don't consider that 'fun' any more. 微笑

Best of luck ... 'spirit of sharing', Ken


回复Ken Task

Re: TeX Filter doesn't work

Михаил Волобой -

About installation of TeXLive: https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#installation My steps, as I remember:

> perl /path/to/installer/install-tl
> D; 1; ... ; R (for change /usr/bin/... to my /site/public_html/latex)
> I (for start installation process)
PATH settings
So, that's all. 


mimetex.linux has 777-permission 

latex, dvips, dvisvgm have 777-permission

回复Михаил Волобой

Re: TeX Filter doesn't work

Ken Task -
Particularly helpful Moodlers的头像

Interesting ... so you do have some command line access .... didn't know one could install texalive via perl.   Congrats on that ... you did some digging there!  That does make sense as a LAMP box ... the P includes perl so that would be installed on even shared hosting.

So at the head of latex or dvips or dvisvgm what's the first line?   ELF?

If ELF, here's what one is dealing with:

https://en.wikipedia.org/wiki/Executable_and_Linkable_Format

'spirit of sharing', Ken



回复Ken Task

Re: TeX Filter doesn't work

Михаил Волобой -

Yes, at the head of dvips and dvisvgm I have ELF. Is it not usual for any TeXLive? 

My question would seem silly, but how this information (knowledge about ELF) can help to convert .dvi or .ps to .svg?

Thank you!

回复Михаил Волобой

Re: TeX Filter doesn't work

Ken Task -
Particularly helpful Moodlers的头像

First, am not a computer science shingled professional ... just an educator that explores ... a lot.

Had I not responded at all ... I wonder if your posting would have attracted any attention by anyone with the experience level enough to do what you are attempting to do.    One might find better information in other forums related to convert/ImageMagick or TextAlive.  微笑

On a standalone/not shared server where the OP has full control of package manager for the platform, one can install anything rather easily.   In your case, not so.   What does ELF mean to you?   linked libraries ... stuff you don't see but are there for some things to function ... like convert.     Now if one had the ability to compile from src that might be a different story ... but ...

Translation: think you are attempting mission impossible on a shared host.

Even if one finds a way, nearly everything eventually needs fixes/patches.  How much trouble will it be to make sure you have the most secure version of whatever installed via hack the box method?   The fact you are attempting installation in web root/document root could leave a hole.

Still think your best option is to contact hosting provider and inquire about upgrade of your account to VPS where you have full control.    Yes, it would mean it cost more, but might be worth it - all things considered.

'spirit of sharing', Ken


回复Ken Task

Re: TeX Filter doesn't work

Михаил Волобой -

The problem was in .dvi to .ps process. When I deleted key -E from command "dvips -E file.dvi -o file.ps" in texdebug.php.

After that I deleted the same key from latex.php. And now I have another problem - broken-image-picture instead of formula. But in TeX Debugger everything works perfectly!