summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-atsigns.html
blob: 4aa0f3ab2a479c7775ed233f09fe6747f911842a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<head>
<title>UK TeX FAQ -- question label atsigns</title>
</head><body>
<h3><code>\</code><code>@</code> and <code>@</code> in macro names</h3>
<p/>Macro names containing <code>@</code> are <em>internal</em> to LaTeX, and
without special treatment just don&#8217;t work in ordinary use.  A nice
example of the problems caused is discussed in 
<a href="FAQ-atvert.html"><code>\</code><code>@</code> in vertical mode</a>&#8221;.
<p/>The problems users see are caused by copying bits of a class
(<code>.cls</code> file) or 
package (<code>.sty</code> file) into a document, or by including a class or
package file into a LaTeX document by some means other than
<code>\</code><code>documentclass</code> or <code>\</code><code>usepackage</code>.  LaTeX defines internal
commands whose names contain the character <code>@</code> to
avoid clashes between its internal names and names that we would
normally use in our documents.  In order that these commands may work
at all, <code>\</code><code>documentclass</code> and <code>\</code><code>usepackage</code> play around with the
meaning of <code>@</code>.
<p/>If you&#8217;ve included a file some other way (for example, using
<code>\</code><code>input</code>), you can probably solve the problem by using the correct
command.
<p/>If you&#8217;re using a fragment of a package or class, you may well feel
confused: books such as the first edition of the 
<a href="FAQ-books.html">The LaTeX Companion</a> 
are full of fragments of packages as examples for you to employ.
The second edition of the <em>Companion</em> makes clearer how you
should use these fragments, and in addition, the code of
all the examples is now available on CTAN.
To see the technique in practice, look at the example below, from file
<i>2-2-7.ltx</i> in the <em>Companion</em> examples directory:
<blockquote>
<pre>
\makeatletter
\renewcommand\subsection{\@startsection
  {subsection}{2}{0mm}%name, level, indent
  {-\baselineskip}%             beforeskip
  {0.5\baselineskip}%            afterskip
  {\normalfont\normalsize\itshape}}% style
\makeatother
</pre>
</blockquote><p>
(That example appears on page 29 of <em>The LaTeX Companion</em>,
second edition.)
<p/>The alternative is to treat all these fragments as a package proper,
bundling them up into a <code>.sty</code> file and including them with
<code>\</code><code>usepackage</code>; this way you hide your LaTeX internal code somewhere
that LaTeX internal code is expected, which often looks &#8216;tidier&#8217;.
<dl>
<dt><tt><i>Examples from the Companion</i></tt><dd><a href="http://mirror.ctan.org/info/examples/tlc2.zip">info/examples/tlc2</a> (or <a href="http://mirror.ctan.org/info/examples/tlc2/">browse the directory</a>)
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=atsigns">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=atsigns</a>
</body>