Thursday, December 4, 2008

 

The Miktex Tex Processing Freeware Program

This is a post from 2005 that I'll copy here, with the old comments as part of the post.

The free Miktex (http://www.miktex.org/) looks to be an excellent latex and tex Windows processor program. I’ve been using SWP, and putting figures in looks to work better in Miktex. Miktex gets PDF’s right, which my version of SWP does not always do, and it processes straight from myfile.tex to myfile.pdf. On the other hand, it has some problems, noted below, which make it unhandier to use.

(1) I have a suggestion for the standard installation instructions: say more about the Windows command prompt. I haven’t used it for years, though I happened to remember it was in Accessories. Also, the user should know that he can change the default directory in teh command prompt to wherever he keeps his tex input files– say, d:/smith/latex-input, using the Properties (reachable by right clicking the command prompt).

(2) The command prompt requires you to type in all your commands, which is burdensome if they are long, e.g.,

pdflatex D:\_home\_HomeWD\INCOMING\FIGURECOPY/myfilewithalongname.tex

You can’t copy and paste in the usual way with CTRL-C and CTRL-V. What you can do, though is to copy to the clipboard with CTRL-C and then paste by rightclicking on the Command Prompt program and choosing PASTE.

I will put a comment line like this at the start of my tex files:

% pdflatex chap07_MoralHazard.tex

then I can copy all but the % part and paste it into the command prompt, and it will process chap07_MoralHazard.tex and write to chap07_MoralHazard.pdf

(3) Something better would be a graphic interface to replace the command prompt. I don’t know how to write such an interface, but here is what it would be: It would be simple: just a window in which the user could do two things:

1. Browse and choose a tex file to process, e.g., myfilewithalongname.tex, instead of having to type in the full name in the command prompt, and instead of having to have it in the command prompt’s directory.

2. Issue the processing command— most simply “latex myfilewithalongname.tex”, or “pdflatex”, or others that might be useful. There should be two to five choices, and the user would check the box of the command he wants to use.

The command would take the file from (1) and put the output in the same directory as the input.

The interface could be fancier, but that covers what the user needs every single time he uses Miktex, and it would save a lot of tricky typing.

(4) Miktex is fouled up by carriage returns, even ones that are not hard breaks. Thus, before I tex my files using it I need to strip off all the carriage returns, thus making all my equations, nicely separated into separate lines for visibility, into unreadable paragraphs. The solution, from Alan, the commentor below, is to make sure my input file is in UTF-8 Ascii, not ANSI. What I do in Textpad is (a) make sure it is set to UTF-8 as the standard encoding, (b) copy the entire file, and then close the file, (c) open a new file and paste what I copied, (d) save the new file with the old file’s name, on top of it. That converts from the ANSI coding I initially had to the UTF-8.

(5) The command which takes us straight from myfile.tex to the output myfile.pdf produces pdf files which are not crystal clear on the screen. The commands

latex -job-name=chap07_MoralHazard temp.tex dvips -Ppdf chap07_MoralHazard.dvi

do better, but then I can’t use JPG files in my input.

(7) Will I switch from SWP to Miktex? Money is not really a concern for me, but usability is. I’ll try it for a while and see.

13 Responses to “The Miktex Tex Processing Freeware Program”

  1. Alan Says:

    Eric,

    I am not a user of SWP myself, but I do believe there are a number of ways in which SWP deviates from “standard” LaTeX (I’ve had these cause problems when sharing files with SWP users). MiKTeX, along with TeXLive, teTeX, and most other TeX distributions will have the same issues you describe here with respect to SWP. That said, allow me to attempt to address a few of your points:

    (2) and (3): I have rarely invoked LaTeX from the command line, whether using MiKTeX or another LaTeX distribution. Many, if not most, LaTeX users use an editor that handles the direct interaction with the LaTeX executable and friends. SWP is really nothing more than a very fancy LaTeX front-end. While the editors that most folks use are not as fancy, they do handle all of the command line work and make invoking LaTeX transparent to the user. Some popular Windows-friendly text editors than can be configured in this way are WinEdt (shareware), TeXnicCenter (freeware), and Emacs with appropriate plug- ins (open source), though there are a number of others.

    (4): Not sure why you’re experiencing problems with hard carriage returns. My files are chock full of them and MiKTeX handles them without complaint, so I suspect SWP is to blame here. Perhaps it is using an odd end-of-line character? Open one of your SWP files in a plain text editor (Notepad — but not Wordpad — will do) and see if it is read correctly, or if garbage appears at the end of the line. Alternatively, write a dummy LaTeX file with hard carriage returns using Notepad and see how it goes. Finally, I understand there’s a way to export files from SWP in a way that is supposed to make them more compatible with “standard” LaTeX systems — if true, you might try exporting your files in this manner before running them through MiKTeX.

    (5): The problem here is that pdfLaTeX is using Type 3 Postscript fonts instead of the more desirable Type 1 fonts. Since I don’t use pdfLaTeX myself, I can’t tell you for sure how to change it (though installing the cm-super package via the MiKTeX package manager might do the trick). A search of the usenet newsgroup comp.text.tex (via groups.google.com) should get you an answer pretty quickly, though.

    (6): MiKTeX does not recognize \tag because it is not part of standard LaTeX. To use it, you must call \usepackage{amsmath} in your preamble. Apparently, SWP does this for you whether you like it or not. Fortunately, amsmath is distributed with MiKTeX and virtually every other LaTeX distribution, so it should already be installed.

    (7): SWP insulates you from some of the low-level LaTeX drudgery at the cost of making your .tex files a little less portable. Another side-effect of this insulation is that you don’t always know what’s going on “behind the scenes,” as you saw when you tried to use the \tag command without \usepackage{amsmath}.

    Alan

  2. Administrator Says:

    Thanks!

    Adding \usepackage{amsmath} makes the tag command work again for equation special labelling.

    I still have the problem with line returns. It isn’t SWP– I actually write my latex files in Textpad, a text editor, and then used SWP only as a front-end— hence its inferiority to Miktex for me, since I don’t use most of SWP’s special features anyway. Also, the line return problem occurs when there are line returns in equations.

  3. Administrator Says:

    I updated the original post in light of Alan’s comments, so his comments won’t apply well any more.

  4. Stefan Moebius Says:

    On (3): Maybe a tool modelled after OggDrop (http://www.vorbis.com/software.psp?pid=2) would be what you need? You just grab the .tex or .mp or .dvi file and drag it to a floating icon. Dropping it would invoke the correct program based on file type and configuration (e.g., pdflatex or latex).

  5. Administrator Says:

    Yes, Stefan. Oggdrop is just for sound files, it seems. What would be a nice utility is a program that lets you say that any file dropped into an icon gets sent to the command line and processed using a particular command, with the output returned to the directory of the original file. I tries looking in the freeware site http://www.nonags.com/nonags/cl.html but couldn’t find such a thing.

  6. Harald Oehlmann Says:

    I use Textpad too (but pdftex to generate postscript directly). You can invoke the pdftex processor from the editor by assigning for example Cntrl-1 to invoke latex. I use: Menue: Config->Settings:Extras -> Add Program and edit properties: Parameter: $File

  7. Stefan Grosse Says:

    I also must say that using command prompt is a very unusual way for working with miktex. The perfect editor for me is winedt where you just have to push a button for texifying and pdf-texifying.

    With the carriage return- I noticed that there is a problem by opening a book chapter from your page. Winedt corrected it but I did not try to compile since there was a lot of scientific word stuff inside.

    If you like to use scientific workplace with miktex as LaTeX distro see the notes of Prof. Söderlind: http://home.tiscalinet.ch/paulsoderlind/Software/Software.html

    By the way the game trees do not look that great there is a package of Martin Osborn using pstricks to improve that: http://www.chass.utoronto.ca/~osborne/latex/index.html

  8. Misha Says:

    Actually, I have another suggestion on how to improve MiKTeX. It takes relatively long to load all the definitions and packages every time TeX starts. Wouldn’t it be nice if there were a running instance of TeX, that would remember all those .sty files. In this case, LaTeX would just invoke that process rather than loading the definitions again.

  9. Administrator Says:

    Thanks, everyone, for these very useful comments. Harald Oehlmann’s suggestion seems to work perfectly, though I had to set it up a bit differently than he suggested, perhaps because of my version of Textpad. Here is what I’ve just added to my latex notes in http://rasmusen.org/x/myfiles/latex-rasmusen.txt

    RUNNING MIKTEX FROM THE TEXTPAD TEXT EDITOR

    Harald Oehlmann told me how to do this. Here are precise instructions for running miktex from Textpad 4.7.3. Maybe other text editors have similar features.

    1. Click on Configure, then Preferences, then Tools.

    2. In Tools, click ADD, then choose DOS Command. A box will appear, and write “pdflatex a file” as a title for the tool. Then click APPLY.

    3. Click on the + sign next to Tools. Several tool titles will appear, including your new “pdflatex a file”. Click on it, and a Properties box will appear with various things for you to type in.

    4. Under Parameters, type in “pdflatex $File”. Make sure that under Initial Folder,there is $FileDir. Make sure none of the options boxes are checked, including CAPTURE OUTPUT. Click OK when you’re done.

    5. Load a tex file into Textpad. To process it, click on Tools from the front set of headings (File, Edit, Search, View, Tools, … ) Then click on “pdflatex a file”, which you will have added.

    6. The Command Prompt window will appear, and the tex file in textpad will be processed. The PDF file will be generated as output.

    I hope I didn’t miss any steps.

  10. Bob Says:

    First, hello Eric, from the distant past. We knew each other at MIT.

    Here’s another simple way to compile a .tex file using the MikTeX texify command. (I have to admit I live at the command prompt. Just a matter of preference. I also live in Emacs!) I turn .tex into .pdf using this batch file:

    texify %1.tex dvips -tletter -Ppdf -G0 %1 call ps2pdf13 %1.ps %1.pdf

    You put these commands in a file called “makepdf.bat”, and place the file somewhere in your path. Then if you have a .tex file called “foo.tex”, at the command prompt you type

    makepdf foo

    and you will end up with a pdf version of your document.

  11. bob wolfe Says:

    Eric,

    I used to be an avid fan of SWP. I now use Miktex.

    1) I used to run into problems with carriage returns. They all arose when I shared files with colleagues who used UNIX. They have now all switched away from UNIX (despite them calling me all kinds of nasty names a decade ago for using Windows) so the problem is now fixed.

    2) SWP is not standard. I use a lot of math. \mbox does not work right in SWP. That prevented me from sharing with lots of colleagues who use standard latex. I think there are other things that are not standard in SWP. That makes it a pain to collaborate.

    3) SWP consultants used to have an attitude. Maybe the attitude is now fixed, so I apologize for any aspersions suggested by these comments. When I asked for work arounds on how to solve the problem of working with colleagues who use standard latex, the SWP consultants were extremely defensive in their responses. Not vulgar, but close to it. Almost as bad as the Apple community used to be towards Windows users.

    4) The real raison d’etre for SWP is its integration with Maple. Beautiful. Wonderful. I love the concept. Maple does simple math very well, up to algebra and closed form calculus. It does not do hard problems well at all, such as infinite sums. So, you have to do the math to see if it is right anyway, and then it is about as easy to type it in yourself in latex as to use the simplify verbs available in maple. If you are teaching calc 101 or high school algebra, then SWP is great. If you are teaching quantitative graduate courses, then be careful with SWP.

  12. Maciej Radziejewski Says:

    Your idea of having a simple IDE (point (3) of your original post) is already implemented in Windows! Well, almost.

    You can browse your files using Windows Explorer. Then you can compile (texify) by right-clicking a TeX file and selecting an appropriate command from the context menu. You just have to define a context menu action for .tex files. I usually define “Latex”, but you may prefer to use pdfLatex or to call some batch file for more complex processing.

    Defining actions takes some knwoledge and it may be a good idea to suggest it to Christian Schenk to do it in the installer as an option (if it is not already there). You can define actions using the “file types” tab (in WinXP accessible from the explorer window - Tools - Options) or using regedit (dangerous if you misuse it).

  13. Eric Wilson Says:

    Maybe I’m missing something here. Why not use WinEdt? It’s a great editor, designed particularly for LaTeX. TexShop is ok for macs.

Labels: ,

 

To view the post on a separate page, click: at (the permalink).