निरंजन
I have a set of acronyms. I want each of the acronym-key to be a command resulting in \acrshort{}. See this Not Working Example (Shall we have something like NWE? :P) -


\documentclass{article}
\usepackage[acronyms,nonumberlist]{glossaries}
\newcommand{\newacro}[3]
{\newacronym{#1}{#2}{#3}
\newcommand{\#1}{\acrshort{#1}} % Of course this won't work as \# is already defined.
}
\makeglossaries
\newacronym{abc}{abc}{abcde}
\newacronym{fgh}{fgh}{fghij}
\newacronym{klm}{klm}{klmno}
\newacronym{pqr}{pqr}{pqrs}
\newacro{vwx}{vwx}{vwxyz}

\begin{document}
% \vwx should work.
\end{document}

Skillmon
Using \csname you can build a control-sequence name out of other tokens. Using \expandafter you can expand \csname before \newcommand does its job.


\documentclass{article}
\usepackage[acronyms,nonumberlist]{glossaries}
\newcommand{\newacro}[3]
{%
\newacronym{#1}{#2}{#3}%
\expandafter\newcommand\csname#1\endcsname{\acrshort{#1}}%
}
\makeglossaries
\newacronym{abc}{abc}{abcde}
\newacronym{fgh}{fgh}{fghij}
\newacronym{klm}{klm}{klmno}
\newacronym{pqr}{pqr}{pqrs}
\newacro{vwx}{vwx}{vwxyz}

\begin{document}
\vwx\ should work.
\end{document}

joulev
This is how you do it in LaTeX3. That is the future LaTeX: no need to mess with \expandafter and expansion controls ;)


\documentclass{article}
\usepackage{expl3}
\ExplSyntaxOn
\cs_new:Npn \definesomecommands #1#2
{
\cs_new:cpn {#1} {#2}
}
\ExplSyntaxOff
\begin{document}
\definesomecommands{anexamplecommand}{hello world}
\anexamplecommand
\end{document}


![blob](/image?hash=93af1eedd7610e0c81d808da937affeb88a508001c5dfee246ca7ea462801d97)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.