0

I'm trying to go about learning LaTeX and would really like to be able to write up documents in my preferred IDE (Spyder) and render them there. I've been trying for some time to get it working but the truth is I'm not very adept at understanding these aspects of IDEs. I've downloaded the MikTex package from anaconda.org but don't seem to be able to get Spyder to recognise .tex documents. I can open them in it but it just disables the run command.

From what I can gather I may need to have pdflatex.exe or something similar in the PATH of Spyder (or possibly the MikTeX bin?) but I don't know if that's even possible? How would I go about setting this up step by step? I know you can define the PYTHONPATH but this seems different as it's just for packages. I know you can change where the Python Interpreter is looked for but this doesn't work with a generic .exe and I'd rather not switch the Interpreter every time I go between python & LaTeX.

Oh also pdflatex.exe runs in the environment console in Anaconda but not in the IPython console in Spyder. So I do at least have pdflatex.exe if needed, but it seems unrecognised by Spyder.

I've found a few other posts evidencing that people have managed to do this in the past and I feel I must be missing something. The MikTex package seems to have little to no documentation either unfortunately but people talk about its usage and I feel it must exist for this reason?

1
  • 1
    Please provide enough code so others can better understand or reproduce the problem. Commented Oct 6, 2024 at 14:21

2 Answers 2

0

MiKTeX is just a distribution of TeX related tools. Few of many: TeX, LaTeX, XeTeX, pdfTeX, pdfLaTeX, luaTeX, luaLaTeX, bibTeX, bibLaTeX, biber,...

It does not contain anything to write .tex files. It does provide one viewer - yap - to preview .dvi files (output from TeX and LaTeX).

IDE is user's taste and user's responsibility. Same as postprocessing. (postscript / pdf).

It is fine you can't find IDE documentation in MiKTeX - it has never been intended to provide any IDE.


After some time you'll recognise there is no One TeX compiler to suit every task. The sooner you give up on such idea, the better for you. Trust me.

Typical compile queue for simple document with citations is:

1. pdfLaTeX - include changes
2. bibLaTeX - update citation references metadata
3. pdfLaTeX - update citation references
4. pdfLaTeX - update page references

This workflow vary from document to document.

Sometimes you are happy with (plain) LaTeX. Sometimes you prefer pdfLaTeX. For other tasks you are looing for XeLaTeX or luaLaTeX. Sometimes you don't need bibLaTeX. Sometimes you want to use makeindex or other packages.

Dedicated (La)TeX IDEs are designed with this in mind. For example, TeXmaker, have F-shortcuts one to run default compiler and preview afterwards, other just to run default compiler, another to run luaLaTeX compiler, another for bibLaTeX, etc.

On the other hand, every IDE has its own shorcut philosophy and keeping in mind whether "compile" is bound to F5, F6, F1 or Ctrl+Enter is irritating.


Other thing is syntax and overall philosophy. TeX is not a programing language. It does not have 'variable' in its core; 'variable' was retrofitted in there. TeX's foundations are character classes and macros. Those are TeX's primitives and averything else is built on it.

From user perspective there is no syntactical difference between macro (\TeX) and length "variable" (\ex).

LaTeX macro name, or command, starts with \. It ends either with the first non-text character (\!, \%,...), or with empty space or non-text character (\section{Foo}, \rm Foo).

Commands are usually single. Paired commands are usually only \begin{Foo}--\end{Foo}, where Foo is called environment, or \if -- \fi interpretation of conditionals.

TeX recognises two 'modes' - text mode and math mode. They behive differently and different command can be used. Some commands are exclusive to one mode or another. For example ^ to introduce upper index is available only in math mode.

All this is covered in all TeX-oriented IDEs. They usually detect default mode switching to highlight math mode. I'm not sure Spyder can do that (easily).


If you want to set your IDE to compile properly, you can download TeXmaker and check it's compiler calls from Preferences... card.

If you decide to go this way, consider writing a blog post about your journey either to show others the way to follow, or (and I'd bet one CZK on it) show others why not to try it.

Sign up to request clarification or add additional context in comments.

Comments

0

MiKTeX and other alternatives to a "Full Blown" over 4 GB TL (TeX Live) distribution, were intended to be minimalist with in effect a Portable "just in time" distribution system. They should have FULL documentation same as full system but only when you know you need it!

From Feb 2024 Manual https://github.com/TeXworks/manual/releases

Creating a document

3.2.1 Writing the document

As an example of the use of TEXworks, we will work with LATEX, but any other TEX system is possible. In particular, if you need to use some special fonts —a mandatory font for an official template, non-Latin alphabets, etc.—the XETEX system is very powerful.

Thus MiKTeX and other Mini-TeX systems, do "potentially" have ALL the IDE features of ANY TeX Distro such as PDF viewer etc., but they may need to be invoked before use, and that is not a simple new user task.

MiKTeX will use exactly the same TeX editor as TeX Live or WTEX32 etc.

MiKTeX Portable\texmfs\data\TeXworks my shortcut to my exe is enter image description here

"F:\LaTeX\MiKTeXPortable\texmfs\install\miktex\bin\texworks.exe"

enter image description here

It is very efficient in the experienced users hands but then a TeXpert usually avoids any IDE and writes the .TeX in a text editor, and command line compiles.

But often with these trimmed systems you need to say you want the functions first in their user configuration. One way round that in the past was a MikteX variation called PROTeXt which was a full blown issue with TeXStudio, but I think PT was dropped in recent years, since "on the fly" distribution was increasingly used.

So you don't need an IDE to run LaTeX it is a shell command line system.

You could "go commando" and echo each line to a text file then call PDFLaTeX text.txt (often done that). Add the signal for SyncTeX support and you get two-way hopping from TeX to PDF and back again without any IDE involved.

I can run MS Notepad as editor and Edge as compiled PDF viewer but Edge has no "SyncTeX" support for to and fro working. So can use VBS from any SyncTeX supported PDF viewer.

What you need is for Spyder IDE to have the built in features of "syncing" with PDF LaTeX files on your OS Shell platform. Or simpler use the 15 years hard wire provided inbuilt TeX facilities.

https://tug.org/texworks/

enter image description here enter image description here

Comments

Your Answer

Draft saved
Draft discarded

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.