Latex preview

Messages in english

Modérateur : xcasadmin

Répondre
XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Latex preview

Message par XcasEngGuy » jeu. sept. 17, 2020 6:01 pm

The file menu has a

File>LaTex>latex preview

command. In the

Cfg>General configuration

menu there is a "PS view" box in the dialog. It appears to be a place to put a command to create the preview. I can't figure out how to use it. I have a cygwin bash script that creates a PDF the way I like it ( I can hide grouped levels, show just resulting equations, etc.). Is there a way to run that script from inside Xcas (like click the File>LaTex>latex preview) by putting something in the "PS view" box. Actually I am open to any method to run my script from inside Xcas. I am running Win10 with 64bit Xcas and I have Cygwin installed.

Thanks,
Matt

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Latex preview

Message par parisse » jeu. sept. 17, 2020 6:24 pm

Xcas for windows has it's own minimal cygwin installation, independant from your own cygwin installation. You can certainly add bash scripts in the xcas directory and run them but they will only be able to run Windows programs and cygwin programs that are provided with this minimal installation.
I have no idea if it's possible to run another cygwin shell and it's own programs, perhaps it's possible to call your cygwin bash shell and pass arguments. Another possibility is try to run a windows batch script.

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex preview

Message par XcasEngGuy » jeu. sept. 17, 2020 7:47 pm

I will try those options. I think I can get it to work if I know how to use the "PS view" dialog box. I tried putting commands in the "PS view" dialog box and was not able to get any response when I click File>LaTex>latex preview.

Is the "PS view" script linked to some other menu command?

Matt

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Latex preview

Message par parisse » ven. sept. 18, 2020 1:41 pm

I just looked at the source code, the Preview PS field is only used if you print a session (or some levels) from the Print menu (moreover some parts seems disabled in win32), it does not apply to the Latex menu.
For latex preview under windows, Xcas is calling the scripts latex.bat and xdvi.bat from the Xcas directory. It should be easy to edit them and get what you want.

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex preview

Message par XcasEngGuy » ven. sept. 18, 2020 5:01 pm

Perfect. Thanks

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex preview

Message par XcasEngGuy » dim. sept. 20, 2020 9:47 pm

I modified:

latex.bat
to
rem set PATH=%PATH%;c:\Program Files\TeXLive\bin\win32
rem set TEXMFCNF=c:\Program Files\TeXLive\texmf-var\web2c
rem set TEXMFTEMP=c:\Program Files\TeXLive\temp
echo %1 %2 %3 %4 %5 %6 %7 %8 %9 >%USERPROFILE%\desktop\xcas_latex_info.txt

and
xdvi.bat
to
rem set PATH=%PATH%;c:\Program Files\TeXLive\bin\win32
rem set TEXMFCNF=c:\Program Files\TeXLive\texmf-var\web2c
rem set TEXMFTEMP=c:\Program Files\TeXLive\temp
echo %1 >%USERPROFILE%\desktop\xcas_xdvi_info.txt

neither file seems to run if I click the menu items in File>Print ir File>LaTex. If I run them independently from Explorer they produce the respective output files.

could you check if they run for you?

Thanks,
Matt

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Latex preview

Message par parisse » lun. sept. 21, 2020 1:17 pm

It does indeed not run the command. I could get it running by starting xcas from my cygwin64 bash (it's the same bash as in /c/xcas64).

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex preview

Message par XcasEngGuy » lun. sept. 21, 2020 3:20 pm

This is interesting. When I run from bash in cygwin and click File>LaTex>Latex preview, the commands

/xcas64/latex.bat /cygdrive/c/Users/Matt/Desktop/test_intg
/xcas64/xdvi.bat /cygdrive/c/Users/Matt/Desktop/test_intg &

get sent to stderr which I could redirect to sh or bash. Were you able to get them to run? I used both Windows cmd scripts and bash scripts in them and couldn't get a response.

Thanks,
Matt

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex preview

Message par XcasEngGuy » lun. sept. 21, 2020 9:56 pm

I was trying to use grep in the xcas directory and got

missing cygpcre-1.dll

It appears the cygwin version is 2.0.0 (in cygwin1.dll). Do you know where I can find cygpcre-1.dll for that version?

(still working on this)
I think it would be great if I can effectively get a latex preview working from inside xcas. I'm kind of going in the back door right now. I noticed the runxcas.en script outputs the command for latex.bat to stderr every time I run "latex preview". I was going to grep it out of the output stream and use that to cause my script to run.

Thanks for spending time on this,
Matt

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Latex preview

Message par parisse » mar. sept. 22, 2020 5:53 pm

I have it on my hard drive. I'm afraid you will need other dlls from my cygwin install, I have therefore archived all cyg*dll from my /usr/bin here https://www-fourier.univ-grenoble-alpes ... ll.tar.bz2

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex preview

Message par XcasEngGuy » mar. sept. 22, 2020 7:37 pm

Thank you!

This will help I'm sure.

Matt

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex preview

Message par XcasEngGuy » ven. sept. 25, 2020 7:54 pm

I got the script modified to pipe just the command from stderr to a shell, but I can't get the pipe to flush until Xcas closes. Almost worked. Is there any way to reenable a call to a script in windows when I click "latex preview"?

Thanks again,
Matt

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Latex preview

Message par parisse » dim. sept. 27, 2020 8:55 am

Sorry, I have no idea...

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex preview

Message par XcasEngGuy » mar. sept. 29, 2020 12:23 am

Sorry, just one more question. When you said "I could get it running by starting xcas from my cygwin64 bash (it's the same bash as in /c/xcas64)." did you mean compiling Xcas in cygwin64 or just running stock Xcas from a cygwin64 bash window?

Matt

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Latex preview

Message par parisse » mar. sept. 29, 2020 4:03 pm

I meant that I ran xcas from the same bash shell that I used to compile Xcas.

Répondre