LaTeX类文件学习

  • 一些命令

    • typeout{Document Style `res’ <26 Sep 89>.} 该命令使得编译时能够打印出参数中的字符串
    • \ProvidesPackage{}[] A package introduces itself using this command. should be identical to the basename of the file itself。

    • 一些命令

      • \LoadClass[options]{name} load class name with the listed options
      • \LoadClassWithOptions{name} load class name with the same options of the current class.
      • \PassOptionsToClass automatically invoke the corresponding options when the class is loaded
  • \newenvironment{name}[num]{before}{after} 可以看成是把before和after两部分内容直接加到name环境的参数,然后放到正文中。效果一样。
    这里写图片描述

  • \maketitle命令会附带日期。去掉日期的方法是添加\date{}命令将日期置空。

  • \newcommand 比 \def 有什么优势?前者检查重定义,不允许\end开头的命令,避免与LaTeX的环境机制冲突。
  • \relax effectively does nothing, 且 The example \let\thanks\relax in a way undefines \thanks. Now \newcommand*\thanks{} wouldn’t raise any errors. it is a safe command to stop expansion of another command. some examples: - (plain tex) \hskip 5pt\relax – in the absence of \relax, the \hskip will keep looking for plus or minus
  • \let 和 \def的区别
    这里写图片描述
  • 逻辑判断
    这里写图片描述
    其中\newif\ifanystr创建了逻辑变量anystr, \anystrtrue命令将anystr置为1,而\anystrfalse命令将anystr置为0;\ifanystr判断,如果anystr置1则执行,否则不执行。
    输出是:
    这里写图片描述
  • @与\makeatletter,\makeatother
    这里写图片描述
    有必要提category code,如下图
    这里写图片描述
    这里写图片描述
    By default, LaTeX will allow the use of the ‘@’ characters for control sequences from within package and class files, but not from within an end-user document. This way it is possible to protect commands,i.e. to make them accessible from packages only. However it is possible to override this security with the duo \makeatletter and \makeatother. These commands only make sense in a regular document, they are not needed in package or class files. 例如(下面的图显示的事.cls文件里的内容,可以看到它可以直接用@符号):
    这里写图片描述
  • 关于\documentclass[margin,line]{….}参数的一些命令
    这里写图片描述
  • 一些普通命令
    • \par 和 \paragraph : The \par command is used to end a paragraph. You can do the same thing by leaving a blank line (pressing Enter twice) in your document source. The \paragraph command is a section heading. It is different from the higher section levels because it places its heading text in the first paragraph.
    • \leavevmode : The \leavevmode is defined by LaTeX and plainTeX and ensures that the vertical mode is ended and horizontal mode is entered. In vertical mode, TeX stacks horizontal boxes vertically, whereas in horizontal mode, they are taken as part of the text line.

猜你喜欢

转载自blog.csdn.net/u012176591/article/details/57074842