summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-atsigns.html
blob: 03ca954246c154eaa79ff5e70fd4e2173738021b (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
<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&rsquo;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>&rdquo;.
<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&rsquo;ve included a file wrongly, you solve the problem by using the
correct command.
<p>If you&rsquo;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.
This problem has been solved in the second edition, and in addition,
all the examples from the <em>Companion</em> are now available on-line.
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 &lsquo;tidier&rsquo;.
<dl>
<dt><tt><i>Examples from the Companion</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/info/examples/tlc2.zip">info/examples/tlc2</a> (<a href="ftp://cam.ctan.org/tex-archive/info/examples/tlc2.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/info/examples/tlc2/">browse</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>