<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Programming LaTeX — writing commands</title>
	<atom:link href="http://hstuart.dk/2007/08/03/programming-latex-%e2%80%94-writing-commands/feed/" rel="self" type="application/rss+xml" />
	<link>http://hstuart.dk/2007/08/03/programming-latex-%e2%80%94-writing-commands/</link>
	<description>A blog on development, baking and the universe.</description>
	<lastBuildDate>Mon, 27 Feb 2012 00:28:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=0</generator>
	<item>
		<title>By: Itay Furman</title>
		<link>http://hstuart.dk/2007/08/03/programming-latex-%e2%80%94-writing-commands/comment-page-1/#comment-16110</link>
		<dc:creator>Itay Furman</dc:creator>
		<pubDate>Wed, 02 Nov 2011 20:25:09 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/index.php/2007/08/03/programming-latex-%e2%80%94-writing-commands/#comment-16110</guid>
		<description>Thanks for the instructive example, which I have found very useful exactly for this purpose.

Three comments:

1. I believe there is a bug in the code of \acopt:
Line 2
       \ifthenelse{\boolean{acronym#1}}
should be
       \ifthenelse{\boolean{acronym#2}}

2. One can avoid using \def, and stick to \newcommand (recommended when possible).
This can be done like this:

\newcommand{\acopt}[2][]{%%
 \ifthenelse{\boolean{acronym#2}}%%
  {\printlongacronym{#2#1}{\csname acronym#2\endcsname}%%
    \setboolean{acronym#2}{false}}%%
  {\printshortacronym{#2#1}}%%
}

\newcommand{\acnoopt}[1]{\acopt[]{#1}}

\makeatletter
\newcommand{\ac}{\@ifnextchar[\acopt\acnoopt}
\makeatother

3. The commands as introduced generate small space before the text that they print (I think only in the first instance, but I didn&#039;t check thoroughly).
This can be avoided by placing comment sign (%) at the line endings inside the macro definitions.
(I commented each line&#039;s ending, but this might not be necessary.)

Thanks for the code,
itay</description>
		<content:encoded><![CDATA[<p>Thanks for the instructive example, which I have found very useful exactly for this purpose.</p>
<p>Three comments:</p>
<p>1. I believe there is a bug in the code of \acopt:<br />
Line 2<br />
       \ifthenelse{\boolean{acronym#1}}<br />
should be<br />
       \ifthenelse{\boolean{acronym#2}}</p>
<p>2. One can avoid using \def, and stick to \newcommand (recommended when possible).<br />
This can be done like this:</p>
<p>\newcommand{\acopt}[2][]{%%<br />
 \ifthenelse{\boolean{acronym#2}}%%<br />
  {\printlongacronym{#2#1}{\csname acronym#2\endcsname}%%<br />
    \setboolean{acronym#2}{false}}%%<br />
  {\printshortacronym{#2#1}}%%<br />
}</p>
<p>\newcommand{\acnoopt}[1]{\acopt[]{#1}}</p>
<p>\makeatletter<br />
\newcommand{\ac}{\@ifnextchar[\acopt\acnoopt}<br />
\makeatother</p>
<p>3. The commands as introduced generate small space before the text that they print (I think only in the first instance, but I didn&#8217;t check thoroughly).<br />
This can be avoided by placing comment sign (%) at the line endings inside the macro definitions.<br />
(I commented each line&#8217;s ending, but this might not be necessary.)</p>
<p>Thanks for the code,<br />
itay</p>
]]></content:encoded>
	</item>
</channel>
</rss>

