There are several errors in your code.
When the replacement text for a macro is absorbed, category codes are fixed once and for all, so
\shorthand@catcode@plus
in the definition of \beginshorthand is several tokens and not one:
\shorthand • @ • c • a • t • c • o • d • e • @ • p • l • u • s
so when \beginshorthand is expanded, TeX defines \shorthand to be followed by @catcode@plus as parameter text
You should use
\edef\shorthand@catcode@plus{\the\catcode`+ }
in order to access the current value of the category code; note the space after +, which is almost mandatory, or when \shorthand@catcode@plus is expanded, TeX won't try to expand prematurely the next token.
In any case, + has category code 12 in all the replacement text, so \def+ is illegal.
The first problem is easily solved by placing \makeatletter and \makeatother outside the definition that needs them.
The fixed category code problem is usually solved by a \lowercase trick (see https://tex.stackexchange.com/a/19750/4427)
\documentclass{article}
\makeatletter
\def\beginshorthand{%
\edef\shorthand@catcode@plus{\the\catcode`+ }%
\begingroup\lccode`~=`+
\lowercase{\endgroup\def~##1~{\textbf{##1}}}%
\catcode`+=\active
}
\def\endshorthand{%
\catcode`\+=\shorthand@catcode@plus
}
\makeatother
\begin{document}
\beginshorthand
+ bold span +
\endshorthand
+ plain span +
\end{document}
However, I'd prefer to use grouping in order to limit the category code change:
\documentclass{article}
\makeatletter
\def\beginshorthand{%
\begingroup
\begingroup\lccode`~=`+
\lowercase{\endgroup\def~##1~{\textbf{##1}}}%
\catcode`+=\active
}
\def\endshorthand{%
\endgroup
}
\makeatother
\begin{document}
\beginshorthand
+ bold span +
\endshorthand
+ plain span +
\end{document}
With grouping you don't need to restore the old category code manually, because TeX will do it by itself.
A different approach, without the \lowercase trick, but which has the defect that it defeats all patching commands of etoolbox, xpatch or regexpatch is activating + beforehand in a group and doing a global definition:
\documentclass{article}
\makeatletter
\begingroup
\catcode`+=\active
\gdef\beginshorthand{%
\begingroup
\def+##1+{\textbf{##1}}%
\catcode`+=\active
}
\endgroup
\def\endshorthand{%
\endgroup
}
\makeatother
\begin{document}
\beginshorthand
+ bold span +
\endshorthand
+ plain span +
\end{document}
\colorsymon \begin{verbbox}[\colorsymon]...\end{verbbox}\colorsymoffinto a single environment. – FK82 Jun 12 '14 at 09:58\colorsymon \begin{verbbox}[\colorsymon]...\end{verbbox}\colorsymoffinto a single environment. That one in particular may be tricky becauseverbboxis a verbatim environment, and verbatim is tricky. So does your question specifically refer to active characters in conjunction with verbatim, or is it more general to the notion of active characters limited to [non-verbatim] environments? – Steven B. Segletes Jun 12 '14 at 10:34\beginshorthand <shorthand-code>\endshorthand(orbegin{shorthand}<shorthand-code>\end{shorthand}in LaTeX fashion). – FK82 Jun 12 '14 at 12:07\par, and only\longmacros are able to incorporate\par. this is built into the tex machinery, and your question is tagged "tex core". if you want the visual effect of an empty line for improved readability, then entering a%sign on a line (that contains nothing else but spaces) will usually suffice; this does not work if\obeyspacesor\obeylinesis in effect, as within a verbatim context. (for learning about core basics, victor eijkhout's "tex by topic" is recommended.) – barbara beeton Jun 12 '14 at 14:35