latex写论文 问题集锦

时间:2022-04-20 20:06:37

LaTeX FAQ


  1. Where can I get LaTeX for Windows?
  2. How can I run LaTeX on a Unix/Linux platform?
  3. I have a problem with amstex and \Bbb
  4. DVIPS can't find tx8r.enc
  5. Which EPS settings do I have to use in Microsoft Visio?
  6. I want to include Java/C++/Pascal source code. How can I get syntax highlighting?
  7. I want to include Mathematica source code. What should I do?
  8. How can I install ConTeXt in my MiKTeX distribution?
  9. AddPause does not work anymore
  10. If I create a PDF file using PS2PDF or PDFLaTeX the paper size is changed to Letter instead of A4
  11. Opening a PDF file doesn't work anymore after installing the latest MiKTeX with Adobe Reader 6
  12. My LaTeX file uses a package that is not installed in the TU/e MiKTeX distribution. Where can I get it and how can I install it?
  13. How can I get bold Greek symbols in equations?
  14. I get a "Substituted line too long" error immediately when I start the MiKTeX installation.
  15. How can I get special symbols (like degree Celsius, euro, copyright) in LaTeX?
  16. Can I include other Graphics formats than EPS or PDF in my LaTeX document (like JPG, GIF, PNG, BMP)?
  17. MiKTeX is installed on my computer, but when I login using a different login name (or on a public computer), some packages cannot be found, MiKTeX Options and EPS2PDF have disappeared, and WinEdt is not registered.
  18. Is it possible to create a PDF file with ALL fonts embedded, including Times, Helvetica, and Symbol?
  19. Do you have a free formula/equation editor for LaTeX?
  20. I get a "LaTeX Error: Counter too large" error message.
  21. Why does my DVI file stop after a certain page, before the actual end of the file?
  22. How can I enable other languages (e.g. German) on my linux system without root priviliges?


1. Where can I get LaTeX for Windows?

At the TU/e we have composed a CD-ROM with a complete installation for LaTeX including the MiKTeX distribution, Ghostview and a Windows Editor (WinEdt, for which we have a limited TU/e license).
You can get a free copy of the MiKTeX CD-ROM from:
  • Jan de Jong (HG 8.86)
You can also use the following network installation:  \\webmath1\miktex29\  (note that the version number may change in the future)

2. How can I run LaTeX on a Unix/Linux platform?

If you are a member of the department of Mathematics and Computer Science, and you have a linux system provided by BCF, you will find that LaTeX is installed. The installed packages and fonts are the same as in the Windows MiKTeX installation. However, if you should have a LaTeX file that compiles in the Windows MiKTeX distribution, but fails to compile in the Unix installation (or the other way around), please send this file along with some remarks to  marko@win.tue.nl .

If you are not a member of the department of mathematics and computer science or if you have installed your own linux system, please contact marko@win.tue.nl to obtain installation instructions for the TU/e packages (including TU/ePDFScreen and TU/e fonts) in linux.

For more information (e.g. about which editor and previewers to use) click the Linux button in the left menu of this page.

3. I have a problem with amstex and \Bbb

Following the instructions on page 218 of the LaTeX Companion to use the Blackboard bold alphabet, which is in the  amstex  package, it is to be expected that code like
\documentclass{report}
\usepackage{amstex}
\begin{document}
The set of real numbers:
\[
\Bbb{R}
\]
\end{document}
is compiled without errors. But the LaTeX compiler gives two errors:
! Package amstex Error:  Package `amstex' is obsolete, substituting `amsmath'.

...

! Undefined control sequence.
l.6 \Bbb
        {R}
?

Replacing amstex by amsmath solves the first error but not the second one. Replacing amsmath byamsmath,amssymb makes LaTeX recognize \Bbb but it reports 
\Bbb is obsolete; \mathbb should be used instead. 
So the LaTeX companion is here a little bit outdated.

An alternative is to load the package bbm and use the command \mathbbm. This generates slightly different symbols, which are usually preferred to mathbb.

4. DVIPS can't find tx8r.enc

This problem can occur in MiKTeX. It is caused by an error in the psfonts.map file, that is located in \MiKTeX\texmf\dvips\config . The solution is quite simple:
  • Open Windows Explorer and go to the directory \MiKTeX\texmf\dvips\config
  • Rename the file psfonts.map to psfonts.map.org
  • Rename the file psfontes.map.miktex-2.0 to psfonts.map
This will solve your problem. Hopefully this problem will be solved in future releases of MiKTeX.

5. Which EPS settings do I have to use in Microsoft Visio?

Before a Visio diagram can be used in a LaTeX document it must be converted to a format the LaTeX utilities can understand: EPS, PDF or PNG. As discussed above, using PNG will lose quality, while converting to PDF generally involves conversion to EPS as a first step. So we discuss conversion to EPS.

One way to do this is with Visio's File->Save As menu. Choosing EPS format will give you the following dialog:

latex写论文 问题集锦
To avoid problems, uncheck the "TIFF preview" - some processing software chokes on it. Do include the "AI format": in at least one observed case, selecting "version 3" produced errors while "version 6" worked fine.

However, this might still not solve all your problems. Some mathematical symbols might not be converted correctly. With Visio 2002, the conversion of curved lines is very poor: circles come out as 12-sided polygons!

Therefore it is best to avoid "Save to EPS" altogether and use a different method: install the Generic Postscript Driver by Adobe, the creator of EPS and PDF. It can be freely downloaded and installed as an extra printer. Printing to this printer using "print to file" will produce a PS or EPS document; select the option "maximum portability" if you still have problems with the result. The filename extension will be .prn.

After changing the filename extension to .eps, the result can be converted to PDF by the Ghostview application or the pstopdf utility. Both are supplied with the TU/e LaTeX installations, for Unix/Linux and for MS Windows.

More information on how to get correct EPS files:

http://www.itee.uq.edu.au/~emmerik/visioeps.html

If the link above does not work, use this link: visioeps.html

6. I want to include Java/C++/Pascal source code. How can I get syntax highlighting?

There is a greate package which supports syntax highlighting for a huge amount of programming languages (Fortran, C, C++, csh, HTML, Java, Matlab, Mathematica, Pascal, Perl, SQL, XML, Delphi, PHP, VBScript, SAS and even LaTeX itself - and many more). The usage is simple:
  1. Load the package: \usepackage{listings}
  2. Set the language: \lstset{language=TeX}
  3. Open a lstlisting environment: \begin{lstlisting}
  4. Include all your programming code
  5. Close the lstlisting environment: \end{lstlisting}

If this does not seem to work for your language, even if the language is listed above, try upgrading to the lastest MiKTeX version. The listings package is being updated continuously.

7. I want to include Mathematica source code. What should I do?

Mathematica has the option  File -> Save As Special... -> TeX . The resulting LaTeX file can be processed as any LaTeX file. One error that still might occur is
! Undefined control sequence.
<argument> ...big [\{\},\IndentingNewLine
You can solve this bug, by placing the following line just below your  \begin{document}  statement.
\newcommand{\IndentingNewLine}{}
If you still get errors, like font issues and style files that cannot be found, then you either do not have our TU/e MiKTeX installation, or you found an error that is new to us. Please report the error to  marko@win.tue.nl .

8. How can I install ConTeXt in my MiKTeX distribution?

Follow these steps to install ConTeXt:
  1. Download and install Perl. A good Perl installation can be downloaded from www.activeperl.com
  2. Open MiKTeX Options from the MiKTeX folder in your Start Menu. Switch to the Packages tab. Click on the + before Formats. Select the checkboxes before context, context-doc, e-TeX and pdf-e-TeX. Press Apply (leave the MiKTeX Options dialog open).
  3. Open the file C:\MiKTeX\localtexmf\pdftex\pdftex.cfg in a text editor (e.g. WinEdt). Add the following line at the bottom of this file and save it:
        map +context.map
        
  4. Open the file C:\MiKTeX\texmf\miktex\config\miktex.ini in a text editor (e.g. WinEdt). Search for the following line in this file:
        pool_size=500000
        
    increase the value of pool_size to 5000000 and save the file.
  5. Go back to MiKTeX Options, go to the TeX Formats tab. Select the pdfetex line and click on Build. Repeat this for pdfelatex, cont-uk and cont-nl.
Now you are ready to use ConTeXt. To test the installation, download this test file:  contexttest.tex . Then open a command prompt window and compile the file both to DVI and PDF:
texexec contexttest
texexec --pdf contexttest
The DVI file can be converted to PostScript in the usual way, using DVIPS. For frequent use, it might be useful to create menu shortcuts and buttons to launch ConTeXt in WinEdt.

9. AddPause does not work anymore

The latest versions op MiKTeX generate PDF 1.4 files. The version of AddPause that is included in MiKTeX 2.1 distributions is not able to handle PDF 1.4 files. The solution is easy: update the PPower4 Java Archive (pp4.jar). Download the new version by clicking on the link below and save it in C:\MiKTeX\localtexmf\tex\latex\pdfscreen  (overwrite the previous version).

Download: pp4.jar

10. If I create a PDF file using PS2PDF or PDFLaTeX the paper size is changed to Letter instead of A4

If you use WinEdt's default settings and run PDFLaTeX or PS2PDF on a A4 sized LaTeX document, the resulting PDF file might have page size Letter (8.5 x 11 inch). To fix this do the following:
  • PS2PDF users: when you create a PostScript file using DVIPS, a dialog is displayed in WinEdt. In this dialog you should change the "Generic Parameters" to -P pdf -t A4 -z (instead of the default -P pdf). WinEdt will remember this setting.
  • PDFLaTeX users: add the a4paper option to the \documentclass command, usually the first line in your LaTeX document. Example:
    \documentclass[11pt,twoside,a4paper]{article}
    
By the way, if you want to use landscape documents, you should do the following:
  1. Load the geometry package with the landscape option:
    \usepackage[landscape]{geometry}
    
    Please notice that the geometry package might overrule settings in other packages, like a4wide, so make sure that you use these packages in the right order.
  2. when you create a PostScript file using DVIPS, a dialog is displayed in WinEdt. In this dialog you should check the 'Landscape' radio button. If you see everything upside-down in GSView, you should check "Swap Landscape" in the Orientation menu.

11. Opening a PDF file doesn't work anymore after installing the latest MiKTeX with Adobe Reader 6

This is a known problem of Adobe Reader and Adobe Acrobat 6.0 in Windows XP. Adobe Reader needs the Windows Journal Viewer and won't start until you install it. You should install Windows Journal Viewer from the Microsoft Download Center:

  • To download Journal Viewer, click here to visit the Microsoft Download Center.
  • In the 'Keywords' search field, type 'Journal Viewer', then click 'Go'.
  • Your search results should return a link to 'Windows Journal Viewer x.x'. Click this link, and follow the download instructions to install Journal Viewer on your machine.
  • Once the program is successfully installed, begin the installation of Adobe Reader 6.0 again.

12. My LaTeX file uses a package that is not installed in the TU/e MiKTeX distribution. Where can I get it and how can I install it?

The simplest solution is to upgrade to MiKTeX 2.4 which is available since January 2004. MiKTeX 2.4 has a new feature that downloads and installs missing packages automatically from the CTAN repository.

If you do not want to upgrade to MiKTeX 2.4, you should run the MiKTeX Package Manager which can be found in the MiKTeX start menu group. The MiKTeX Package Manager will show a list with all available packages. You can simply select a package and click the + button to install it.

13. How can I get bold Greek symbols in equations?

The answer is short: you should use  \boldmath  instead of  \bf . But this may not work in all cases. If it does not work, you should import the package  bm  and use the new command  \bm  instead of  \boldmath .

14. I get a "Substituted line too long" error immediately when I start the MiKTeX installation. How do I solve this problem?

The error probably looks like this:

latex写论文 问题集锦

You should try to reboot your computer and do NOT logon to the TUE domain but on your local computer. Then restart the MiKTeX installation program. You can also try to disconnect all network drives in My Computer (right-click on the drives and select Disconnect). 
If this still doesn't solve your problem, please contact marko@win.tue.nl.

15. How can I get special symbols (like degree Celsius, euro, copyright) in LaTeX?

If you want to use special symbols in LaTeX, you should load the package  textcomp  which defines a huge number of symbols. Examples are:  \textdegree, \textcelsius, \textcopyright  and  \texteuro .
Please note that the generated euro symbol is "uglier" than the one defined in the Adobe fonts. To obtain Adobe's euro symbol, load the package  europs  and use the  \EURofc{}  or  \EUR{}  command.

It is also possible to use the Windows character map to copy and paste symbols like €, é, ä, ò, ©. But in this case you have to specify the input encoding using the package inputenc. The input encoding depends on the computer/operating system that was used to create the tex file:

Macs: \usepackage[applemac]{inputenc}
Unix Latin1: \usepackage[latin1]{inputenc} 
Windows ANSI: \usepackage[ansinew]{inputenc}

16. Can I include other Graphics formats than EPS or PDF in my LaTeX document (like JPG, GIF, PNG, BMP)?

At this moment (March 2005) the following formats are supported by PDFLaTeX: PDF, PNG and JPG. Including a PDF, PNG or JPG image does not require any additional work. Simply load the package  graphicx  and use the command:
\includegraphics[width=\textwidth]{filename}
LaTeX (from the MiKTeX 2.4 distribution) supports the following formats: EPS, PNG and JPG. But using PNG or JPG requires some extra work. First, you will have to specify the bounding box (which is the image size in this case) manually. If you want to add a 800 × 600 JPG or PNG image, you have to use the following code:
\includegraphics[width=\textwidth, bb=0 0 800 600]{filename}
PDFLaTeX will still work if you use this code, but you will get a warning message in the PDFLaTeX output.

There is a second problem: the images will appear grayscale in GSView after running dvips. In order to get coloured JPG or PNG images in your PostScript file, you have to specify extra command line parameters todvips:

dvips -I c filename.dvi
Please note that this does not work (yet?) on a teTeX installation (tested on Fedora 3 and Apple MacOS X).

17. MiKTeX is installed on my computer, but when I login using a different login name (or on a public computer), some packages cannot be found, MiKTeX Options and EPS2PDF have disappeared, and WinEdt is not registered.

The TU/e MiKTeX installation installs MiKTeX and registers WinEdt for the current user only. It is possible however to manually fix the installation settings:
  • First open MiKTeX Options by clicking on the Start button, select Run..., and type the command
    C:\MiKTeX\texmf\miktex\bin\mo.exe
    
    Click on the Roots tab, click on Add, browse to C:\MiKTeX\localtexmf, press OK, click on Declare Local, and finally click on Up to move it to the top of the TEXMF root directories. Then click Apply.

    Now click on the General tab, click on Refresh Now (filename database), and Update Now (Format files). Now all packages will be found.

  • If you want to register WinEdt for the current user, you can enter the registration info by selecting the appropriate menu item in the left hand side menu of this web page.
  • If you want to create a shortcut to EPS2PDF, you can manually create the shortcut to
    C:\MiKTeX\localtexmf\utils\eps2pdf.exe
    
    In the same directory you will find the AddPause command, if you need it.

18. Is it possible to create a PDF file with ALL fonts embedded, including Times, Helvetica, and Symbol?

At this moment (July 2011) it is not possible to make PDFLaTeX embed these fonts (aka the Base-14 fonts) if they are used in external images. PDFLaTeX will embed these fonts only if they are used in the document itself.

It is possible however to tell PS2PDF to embed the fonts.

WinEdt 6.0:

  • Open WinEdt
  • Select: Options, Execution Modes
  • Select ps2pdf
  • Click on "Browse for Executable" (lower left corner)
  • Browse to the gswin32c.exe executable in C:\Program Files\gs\gs9.02\bin
    (you might have another version than 9.02, so please adjust this number) and select it.
  • Enter the following switches:
    -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -r600 -dCompatibilityLevel=1.4
    -dPDFSETTINGS=/printer -dMaxSubsetPct=100 -dSubsetFonts=true
    
  • Enter the following parameters:
    -sOutputFile="%N.pdf" "%N.ps"
    

WinEdt 5.5:

  • Open WinEdt
  • Select: Options, Execution Modes
  • Select ps2pdf
  • The Command Line Switches for gswin32c.exe are
    -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -r600 -dCompatibilityLevel=1.4
    
    Add the following switches to this line:
    -dPDFSETTINGS=/printer -dMaxSubsetPct=100 -dSubsetFonts=true
    -dEmbedAllFonts=true
    
From now on PS2PDF will embed all fonts.

19. Do you have a free formula/equation editor for LaTeX?

One of the good things in LaTeX is that it defines a language to type formulas quicker than using a formula editor, so experienced users often do not want to use a formula editor. But for Windows a very good free formula editor exists: TeXaide, created by Design Science. TeXaide looks like a stripped down version of the commercial formula editor MathType which also has export functionality to Windows programs. But for generating LaTeX code TeXaide is very suitable. You can download the latest version from  www.dessci.com .

20. I get a "LaTeX Error: Counter too large" error message.

You probably have an alphanumeric counter that has a value greater than 26, so it cannot be converted to a letter. The solution is not obvious, since there are only 26 letters in the alphabet. You will either have to change the representation of your counter, or use the  alphalph  package which defines commands that represent numbers larger than 26 as "aa", "ab" etc..

21. Why does my DVI file stop after a certain page, before the actual end of the file?

Some errors prevent LaTeX from creating a DVI of PDF file. The log file states:  No pages of output. , and WinEdt might say:  LaTeX Failed to Create a DVI file . If such an error occurs in the middle of the document, it might be possible that a DVI file is created, but it suddenly stops after the page prior to the error. I have created some documents that generate a "critical error" which makes LaTeX stop at the page with the error:

Example 1: criticalerror1.tex
Error: Unclosed tag.
DVI File: contains only two pages instead of four.

Example 2: criticalerror2.tex
Error: loads a package that is not installed.
DVI File: is not created at all.

Example 3: criticalerror3.tex
Error: environment is not ended.
DVI File: contains only two pages instead of four.

In all cases I can only give you the following advice: read the log file and the LaTeX console output carefully. Usually this should help you to find the critical error. At least you always know that the error occurs on the first page that is not included in your DVI file anymore.

22. How can I enable other languages (e.g. German) on my linux system without root priviliges?

If you want to enable more languages on your linux system (without root priviliges) you should create your own local copy of the  language.dat  configuration file and rebuild the formats. Here is how to copy the default file to your home directory and how to make sure that it is found by the LaTeX distribution:
cd $HOME
mkdir -p .texmf-config/tex/generic/config
cp /usr/share/texmf-config/tex/generic/config/language.dat .texmf-config/tex/generic/config
texhash .texmf-config
The last texhash command creates a file  .texmf-config/ls-R  that makes sure that the program  texconfig can find the local version of  language.dat . Now start the program  texconfig  to modify the settings for hyphenation / latex .

If you choose not to use texconfig, but to modify the language.dat file manually, you should not forget to rebuild the LaTeX format file:

fmtutil --byfmt latex