My LaTex Tips

xiaoxiao2021-03-06  14

1. How to let TEX find your latest macro (* .sty) file? The easiest way is to put your * .sty file into the CTEX directory tree, tapping the texhash command under DOS. Otherwise, Tex Compile will not find your * .sty file.

Detailed explanation:

The TEX system records the names and specific directory locations of the various files required by this database. Every time you add a file to your system, remember to refresh this database, otherwise Tex may not find the required file. The specific command of the refresh file name database depends on the TEX system you use. The command of TETEX and FPTEX is TexHashmiktex users to enter the following command inTexmf --Update-fndB in the DOS window or using the graphics interface tools provided by Miktex MIKTEX Options. Locate Miktex Options in the Start menu, open the Refresh Now button on the General page.

2. Input {file} and the former do not change the page, the latter change the page.

3. Changing the illustration head (default: Figure 1: change to: Figure 1) %% Use CAPTION2 Macro Pack / Renewcommand / FigureName {/ textbf {Figure}}% illustration head %% Definition, "Figure (Table) 1 : Example "Space symbols, such as": ", defined here as empty / renewcommand {}% Define Interval number and title interval / renewcommand {/ captionLabelsep} {/ hspace {1em}}

4. How to make the generated PDF text sticky code? Today is the 3rd day of Latex, more interested. : P I am used to generating a PS file directly in WineDT, and then transfer to a PDF file with the PS2PDF button. However, the results found that in the generated PDF file, copy the text that pasted, but garblered: blink:. Later, I finally figured out a way: After generating a DVI file, use the DVIPDFMX file name .dvi command to generate a PDF file, then copying the text from the copy is no longer garbled, and the Chinese search is no problem.

5. Between Guide is usually below: If it is a system installed package, most of the $ TEXMF $ / DOC / LATEX / The-name-of-the-package directory, such as Hyperref at: $ TEXMF MANUAL.TEX and OPTIONS.TEX under $ / DOC / LATEX / HYPERREF, etc., some comparative science under $ TEXMF $ / DOC / LATEX / BASE.

If it is the system installed package, most of the $ TEXMF $ / DOC / LATEX / The-name-of-the-package directory, such as Hyperref in: $ TEXMF $ / DOC / LATEX / HYPERREF MANUAL.TEX and Options.Tex, etc., some comparative science under $ TEXMF $ / Doc / Latex / Base.

If your own unpacking, it is more likely to install the Package directory. $ localtexmf $ (or $ TEXMF-LOCAL $) / Doc / Latex is also possible.

6. Realize the list of reference numbers to use Overcite or use NATBIB? I think it is to use / usePackage [super] {natbib} than to use / usePackage {overcite}, because 1) Overcite generated document number will format chaos, such as: Since a certain place is discovered. / Cite {sth}. .. If you use an Overcite macro, three will only appear., And before the document number. 2) After using Overcite, the link to the reference document implemented with the Hyperref macro package will not take place. And / UsePackage [super] {natbib} is not equal. 7. Join / UsePackage {hyperref} You can automatically turn the reference to the chart document into hyperlinks, but they are all converted to hyperlinks, as shown in Figure (1), Table (3), and I want to fix the corresponding The text is also hyperlink, namely: (Figure 1), (Table 3), how to implement it? You can use the / autoref function in the {hyperref} package. As long as the reference map or table / ref} can be replaced with / autoref {label}. However, there is a problem that the result of this is in English, ie "Figure 1". If you want to want hyperlinks to become "Figure 1", you can pre-definition: / renewcommand / figureautoreFName {Figure}

You can use the / autoref function in the {hyperref} package. As long as the reference map or table / ref} can be replaced with / autoref {label}. However, there is a problem that the result of this is in English, ie "Figure 1". If you want to want hyperlinks to become "Figure 1", you can pre-definition: / renewcommand / figureautoreFName {Figure}

8. Why do I use Hyperref's PDF Chinese bookmarks? If you use DVIPDFMX, you can add: / atbegindvi {/ special {PDF: Tounicode GBK-EUC-UCS2}}, if you use DVIPDFM or DVIPS, PDFLATEX, etc., use GBK2UNI to process the .out file to generate bookmarks. That is, GBK2UNI is a special program for bookmark "Hanhua", which is compiled .out file, enters GBK2UNI SS.OUT on the command line.

9. How to use Chinese characters in Metapost?

I first use Wang Hao's way: 1). Advanture in the MP file: verbatimtex% & latex / documentclass {article} / available {cjk} {gbk} {cjk} {gbk} {cjk} {GBK} {cjk} {

2). Add: verbatimtex / end {cjk} / end {document} eTex

3) The label is enclosed in BTEX ... ETEX when the label is marked. For example: label.top (BTEX origin eTex, Origin);

But I can't pass it. I thought, the MPost processing Tex section is like this: first use the MPTOTEX program to extract the text between Verbatimtex and ETEX in the text in the text, and the remainder is output to *. MPX files. Then use its default TEX program (default to tex) to translate the * .mpx file into the * .dvi file, then use DVITOMP to turn the * .dvi file to * .mp file, then process the * .mp file into an EPS graphics file. . I found that I use MPOST to handle an error. The step is mainly TEX to convert the * .mpx file into the step of * .dvi file (is my TEX version of the problem (my TEX version is 3.141592 (Miktex 2.4))??? , Means that my TEX actually does not recognize / documentclass or other orders? ! But my LaTex program is normal, because I have been using, so I think, can change MetApost's default TEX program to latex. The method mentioned by Wang Wei is to join% & Latex, so Tex will read itx format, but this method is not a fundamental solution, because the real handler is still tex instead of Latex, so once the TEX version on your machine is different If you have problems, such as someone mentioned (http://www.freelinuxer.net/~firefox/blogger/2004/03/metapost.html) Use TexLive to change% & Latex to% & CSLATEX. In fact, Metapost has a -TEX = TexProgram option, you can modify its default TEX handler, if I want to use the Latex as a Metapost's default TEX handler, you can write:

MPost -Tex = latex test.mp

At this time, you don't need to join% & Latex in your * .mp file, and you don't have to worry about your TEX version, you can use the Chinese characters in Metapost.

10. How do I turn the image format generated by metapost into * .eps format? We know that Metapost generates a graphic file called * .mp source file, which is called * .mps format. This format is different from standard * .eps graphics format, cannot be directly identified by other graphics software such as Photoshop, and cannot be browsed directly by GSView (http://learn.tsinghua.edu.cn/homepage/2001315450/metapost. HTML), can only be inserted as a picture in the * .tex file.

However, sometimes the editorial department needs to attach an independent * .EPS format, while Metapost generated * .mps files often do not apply. To this end, some people deliberately write a shell script under UNIX, can convert the * .mps format into * .eps format. The specific code is as follows: #! / Bash # won @dreamwiz.com>, Someday Before 2001 ## - this script can be used only with bash shell # - LATEX is Required. ## usage: # MPTOEPS ## - wildcards "*" or "" can be used instead of . # - The control "EPS" Files Are Stored in The Current Directory. # for name in $ @; Do if [-f $ name]; the header = `grep -n '%! ps' $ name` Creator =` Grep -n '%% Creat' $ NAME`

IF [$ Header "! =" 1:%! PS "] || [" $ creat "! =" 3: %% CREATOR: MetaPost "] THEN Continue; Fi

DiRName = $ {Name% / *} filename = $ {name ## * /} name_ext = $ {filename ## *.} IF ["$ name_ext" = "mps"]; the Continue; Fi Name_base = $ {filename %. *}

NewFile = $ {name_base} _ $ {name_ext} .eps newname = $ {name_base} _tmp _ $ {name_ext}

if [! -f $ newname.tex]; thencat> $ newname.tex << EOF / documentclass [a4paper, landscape] {article} / usepackage {graphicx} / pagestyle {empty} / setlength {/ textheight} {13in} / SetLength {/ TopMargin} {/ headsep} {0.0in} / setLength {/ TOPSKIP} {0IN} / begin {/ include} / par / centerline {/ includegraphics [scale = 1.0] {$ name} } / End {document} EOF

Latex $ newname> / dev / null 2> & 1 / && dvips -e $ newname -o $ newfile> / dev / null 2> & 1 rm -f $ newname.tex $ newname.dvi $ newname.log $ newname.aux echo "$ Name -> $ newfile" else echo "error: $ newname.tex exists and conversion fails." Fielse Echo "$ name is not a regular file." Fidone, there are also many people who use the Windows version of Latex. So I wrote a program that converts the * .mps format into *. Per MPS format in MS-DOS, called MPS2EPS. Usage is very simple: command line input: MPS2EPS file name

This program can be downloaded from http://www.ctex.org/forums/index.php?act=attach &type=post&id=16180.

11. When defining a new command with / DEF, the name of the command does not have a number. For example, I define the following two commands, conflicts occur when compiling: / Def / C2cnt # 1 # 2 {C $ _2 $ @ $ (# 1, # 2) $} / def / c2chain {C $ _2 $ -Chain} can be changed to: / def / ciicnt # 1 # 2 {C $ _2 $ @ $ (# 1, # 2) $} / def / ciichain {c $ _2 $ -chain}

12. Why do the EPS files exported by Photoshop? Plus bones Box, the specific method is to open the size (for example 800 * 600) with GSView, add BB = 0 0 xy, such as / includegraphics [width = 0.5 / textwidth, bb = 0 0 800 600] {1.eps}

转载请注明原文地址:https://www.9cbs.com/read-49156.html

New Post(0)