0

My admin and me have been unsuccessfully trying to get LaTeX running on my work computer (both portable and non-portable), but we’re both stumped. It turns out that the superadmin has a group policy that users can’t run CMD, but we can use Powershell. Running latex.exe in Powershell is successful (even though if I double click latex.exe it gives me an error of 0xc0000142, so I assume it’s using CMD).

Therefore, is there a way for me to tell my editor, TeXstudio in this case, to use Powershell to call LaTeX instead of CMD?

I found this on TeXstudio's manual, but unfortunately I’m not computer savvy enough to understand if what I want to do is possible.

11
  • I don't think TeXstudio calls the shell at all during builds. The manual says "All commands specified in the configuration (i.e. Commands and User Commands) are executed directly. There is no shell involved." Are you getting an error when trying to run pdflatex in TeXstudio? If so, what is it? I guess it would be telling if TXS also gave the same "0xc0000142" error message. Also, can you show us a picture of Configure TeXstudio -> Commands page just to be sure you are configuring TXS correctly?
    – Troy
    Commented May 18, 2018 at 23:16
  • 1
    Otherwise use sharelatex, aka run it in a browser
    – daleif
    Commented May 18, 2018 at 23:27
  • Imho texstudio is using CREATE_NEW_CONSOLE to get the console output at the bottom but it sounds rather odd if a policy would forbid this. But if this is really the case you could try winedt instead, it has its own console. Commented May 19, 2018 at 12:49
  • @Troy, I was a little confused by what that meant. What made me think that it was using CMD was the mentioning of "command line tools". The Configure Texstudio -> Commands is the default, and just as it appears in the manual for "Pdflatex" (which is one of the ones that's giving me an error). The error on the TeXstudio messages is "Error: Command crashed: pdflatex.exe -synctex=1 -interaction=nonstopmode "myName".tex" I can run the same command from Powershell successfully.
    – ECastro
    Commented May 21, 2018 at 14:04
  • @daleif, that will be my fallback... I rather keep away from browser stuff because my company has it unconventionally tight with firewalls and proxies.. making browsing slow.
    – ECastro
    Commented May 21, 2018 at 14:08

1 Answer 1

1

I ended up solving my problem not using the answer to my question, but for completeness I'll give both the answer and my solution to my problem.

Question: How to run Powershell (PS) commands from TeXstudio?

1) Enable scripting in PS

2) Create whatever PS script you would like to call, say latex.ps1

3) In Options -> Configure TexStudio -> Commands, precede the call to your script with "powershell", e.g., powershell C:\PS_Scripts\latex.ps1 %.tex

Solution to my problem of having a "0xc0000142" error when trying to directly open latex.exe, but not when running it from a batch file or powershell

For some reason (probably due to a group policy), I could not run latex.exe (or any of the other executables such as pdflatex.exe) and I would come up with a "0xc0000142" if I tried manually running them by double-clicking them, or the error of "Error: Command crashed: ..." in the TeXstudio messages if I ran it from TeXstudio.

My solution was to create a .bat file calling the executables, and call the .bat file in Options -> Configure TeXstudio -> Commands instead of the exectuables.

Example:

"pdflatex.bat" file with contents:

    pdflatex.exe -synctex=1 -interaction=nonstopmode %1

Entry in "PdfLaTeX" in Options -> Configure TeXstudio -> Commands

    C:\TeXstudio_bat\pdflatex.bat %.tex

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .