22

As can be seen by my comments here, here and here, I'm currently trying to find out how to see the definitions of environments, but I felt that a new question would be responded to quicker. I want to be able to look up the definitions of environments by myself so that I don't have to waste time looking for the definition on the web or asking a question here. The definition I'm currently looking for is quote, because I want to adjust the indentation of the entire paragraph. I can't find it in source2e.pdf, which led me to believe that it is not a LaTeX environment but a TeX environment (and I don't know where to find the kernel coding for TeX).

Do you advise that I rather look for a package, like quoting, in situations such as this, where I want to adjust the indentation of the entire paragraph, instead of re-defining the quote environment?

4
  • quote is in article.cls (assuming you are using article class). Your log file shows you which source files have been read.
    – Thruston
    Jul 14, 2016 at 7:33
  • You can always use \show to see the macro that defines the environment, e.g. \show\quote. Here, the definition is in the class file (article.cls).
    – Joseph Wright
    Jul 14, 2016 at 7:35
  • 3
    BTW, a definition in LaTeX can never come from plain TeX without the code actually being copied somewhere: plain TeX and LaTeX are different formats and LaTeX does not work 'on top' of plain TeX.
    – Joseph Wright
    Jul 14, 2016 at 7:41
  • @Thruston, thank you. For the record, I found that file in C:\ ... \Programs\MiKTeX 2.9\tex\latex\base\article.cls . @Joseph, I didn't get the information I wanted using \show and looking at the log, but I understand that that information can be useful.
    – ahorn
    Jul 14, 2016 at 8:25

1 Answer 1

20

An environment can be defined

  1. in the LaTeX kernel (list, but also enumerate),

  2. in the document class (quote, titlepage), or

  3. in a package you load.

There's no hard and fast rule for finding what's the case for the environment you want to know about. Of course, if you want to know the definition of bytefield, you'll look in the package that provides it.

Cases 1 and 2 are more difficult to distinguish. As a rule of thumb, the kernel provides for “generic” environments such as list, trivlist, center, flushleft; also enumerate and itemize are defined there, because they're felt as generic. But description is left to the document class like quote and quotation.

Note that you don't find \newenvironment{enumerate} in the LaTeX kernel, for saving token memory (remember that LaTeX was developed when memory resources were not as abundant as they are today).

However, an environment may be redefined by a package you load. An easy example is enumitem, that changes the definitions of enumerate, itemize and description.

A good tool is texdef, distributed with TeX Live; here's a sample session:

> texdef -t latex enumerate

\enumerate:
macro:->\ifnum \@enumdepth >\thr@@ \@toodeep \else \advance \@enumdepth \@ne \edef \@enumctr {enum\romannumeral \the \@enumdepth }\expandafter \list \csname label\@enumctr \endcsname {\usecounter \@enumctr \def \makelabel ##1{\hss \llap {##1}}}\fi

> texdef -t latex -p enumitem enumerate

\enumerate:
macro:->\@protected@testopt \enumerate \\enumerate {}


\\enumerate:
\long macro:[#1]->\enit@enumerate \enitdp@enumerate {enum}\thr@@ {#1}

You may want to try the -s option:

> texdef -t latex -s quote
% article.cls, line 404:
\newenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax}
               {\endlist}

You see that, if possible, the file and line number where the definition is performed are printed in the output. The option doesn't generally work along with -p, though.

1
  • Wow, I didn't know about texdef!
    – lhf
    Jul 14, 2016 at 12:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .