37

Q: How do I use \show to determine macro definitions?.

I've followed advice here: The definitions of LaTeX commands and here: \show with fewer lines? and am still struggling.

I've naively tried running \show\section (to learn about the macro \section) in the WinEdt terminal. No luck. I've placed this code in a simple .tex document to be compiled. No luck.

Note: this is a follow-up to my question: LaTeX equivalent to R's `help foo`?

2
  • welcome and I wish you the best in finding what you need. When formatting questions it's best if you provide the target link's document title as the link's text, as I did in my edits. Feb 24, 2011 at 2:33
  • @Matthew: Got it. Just used your advice in a new post. Thx.
    – lowndrul
    Feb 24, 2011 at 14:24

2 Answers 2

31

I find \show is most useful when used interactively:

b@poppy:~$ latex
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
restricted \write18 enabled.
**\relax
entering extended mode
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.

*\documentclass{article}

*\show\section

(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
> \section=\long macro:
->\@startsection {section}{1}{\z@ }{-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@p
lus .2ex}{\normalfont \Large \bfseries }.
<*> \show\section

? x
No pages of output.

Note the trick in getting LaTeX to talk to you: tell it to \relax.

4
  • Interesting, I've never had much use for interactive mode, but this is a good idea. Feb 24, 2011 at 2:32
  • 2
    I too do this a lot. In fact, any control sequence suffices to get TeX to start paying attention to you. I frequently start with \documentclass{article}.
    – TH.
    Feb 24, 2011 at 2:44
  • really cool. I'll be using that. Thx!
    – lowndrul
    Feb 24, 2011 at 15:13
  • @TH, thanks for the info- I did not know that. I thought it was expecting a file name and \relax told it that it wasn't getting one. Feb 24, 2011 at 20:56
17

The output is shown on the terminal and in the log file. for example

\documentclass{article}
\show\section

prints

> \section=\long macro:
->\@startsection {section}{1}{\z@ }{-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@p
lus .2ex}{\normalfont \Large \bfseries }.
l.2 \show\section

and now TeX is asking what you want to do. If you enter X, it will exit.

2
  • Wonderful! Thank you for the help. Yes, I think things were working before then. I just wasn't distinguishing this output from the rest. I'm curious which commands I can supply other than X. e.g., is there a command that will ignore the \show\section and produce a .pdf? I've posted this as follow-up question at commands in interaction mode
    – lowndrul
    Feb 24, 2011 at 14:08
  • @brianjd: You can type ? to get TeX to tell you what else it responds to. That being S, R, Q, I, 1, 2, ..., 9, H, or X. See the help for what those do. I never use S, R, or Q, but the others are useful.
    – TH.
    Feb 24, 2011 at 21:21

You must log in to answer this question.

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