Below, I'm defining the following commands:
\setkeyword{<keyword>}{<description>} can be used to declare a keyword.
\getkeyword{<keyword>} retrieves the description you provided.
\keywordtable{<key1>,<key2>,…} displays a table containing the descriptions corresponding to a comma-separated list of keywords.
(Note that keywords containing underscores are allowed.)
\documentclass{article}
\usepackage[T1]{fontenc} %% <- necessary for _ to be displayed correctly
\usepackage{etoolbox} %% <- for \csuse, \csdef, \ifcsdef and \forcsvlist
%% Define/retrieve a new keyword:
\newcommand\setkeyword[2]{\csdef{keyw@#1}{#2}}
\newcommand*\getkeyword[1]{%
\ifcsdef{keyw@#1}{% %% <- if the key is defined...
\csuse{keyw@#1}% %% <- return the description
}{% %% <- otherwise...
??% %% <- question marks
%\errmessage{Undefined key: #1}% %% <- or an ERROR, if you prefer
}%
}
%% Display a table describing a list of keywords:
\newcommand*\keywordtable[1]{%
\begin{tabular}{lp{8cm}}
\forcsvlist{\tableentry}{#1} %% <- apply \tableentry to each value in #1
\end{tabular}%
}
\newcommand*\tableentry[1]{%
\formattableentry{\detokenize{#1}}{\getkeyword{#1}}%
}
\newcommand\formattableentry[2]{ #1 & #2 \\ }
% %% Declaration of keywords:
\setkeyword{runtype}{Keyword to determine runtype. Can be 1 or 2. \par
I don't want to hardcode this description twice\ldots}
\setkeyword{param_1}{Keyword to determine the parameter of runtype = 1}
\setkeyword{param_2}{Keyword to determine the parameter of runtype = 2}
\begin{document}
\section{Runtype 1 description}
\keywordtable{runtype,param_1}
\section{Runtype 2 description}
\keywordtable{runtype,param_2}
\end{document}

Some remarks
\setkeyword{<keyword>}{<description>} effectively defines \keyw@<keyword> for you, so that it expands to <definition>. You can't use this macro directly because its name contains an @.
\getkeyword{<keyword>} just calls \keyw@<keyword>.
- I'm using the e-TeX primitive
\detokenize to print the keyword. This command strips all tokens in its argument of their special meaning (by changing their catcodes), so you can for instance use \detokenize{param_1} safely.
- Without
\usepackage[T1]{fontenc}, underscores are displayed as " ̇", rather than as "_". You'll probably want to use this package anyway because of the reasons outlined here.
- I'm using
tabularx to create a table that has the same width as the current line width. You can replace \linewidth by some other value if you want a different width (or just use tabular, in which case you should replace the X column type by something else).
A more customisable version
By request, here is the most customisable version I can think of. This lets you create keywords using \setkeyword{<keyword>}{<key1>=<value1>,<key2>=<value2>,…} and retrieve them using \getkeyword{<keyword>}{<key>}.
You can create a table with rows corresponding a set of keywords and columns corresponding to specific keys using
\keywordtable[<key1>,<key2>,…]{<keyword1>,<keyword2>,…}
I'm using pkgkeys, which is documented in section 82 of the pgf manual.
\documentclass{article}
\usepackage[T1]{fontenc} %% <- necessary for _ to be displayed correctly
\usepackage{pgfkeys} %% <- for everything starting with \pgf
\usepackage{etoolbox} %% <- for \forcsvlist
\newcommand*{\declarekeyword}[1]{%
\pgfkeys{
/keyw/#1/.is family,
/keyw/#1/.unknown/.style = {\pgfkeyscurrentpath/\pgfkeyscurrentname/.initial={##1}},
}%
}
\newcommand\setkeyword[2]{%
\declarekeyword{#1}%
\pgfkeys{/keyw/#1/.cd,name=\detokenize{#1},#2}%
}
\newcommand*\getkeyword[2]{\pgfkeysvalueof{/keyw/#1/#2}}
%% Display a table describing a list of keywords:
\newcommand*\keywordtable[2][name,description]{%
\begin{center}
\begin{tabular}{\forcsvlist{\getkeyword{@alignment}}{#1}}
\forcsvlist{\tableentry[\bfseries]{#1}}{@headings}
\forcsvlist{\tableentry{#1}}{#2}
\end{tabular}
\end{center}%
}
\newcommand*\tableentry[3][]{%
\let\keywcolsep\empty
\forcsvlist{\keywcolsep\def\keywcolsep{&}\formattableentry[#1]{#3}}{#2}\\
}
\newcommand*\formattableentry[3][]{#1{\getkeyword{#2}{#3}}}
%% "Fake" keywords (control column titles and alignment)
\setkeyword{@headings}{name=Parameter,description=Description,value=Value}
\setkeyword{@alignment}{name=l,description=l,value=r}
%% Declaration of keywords:
\setkeyword{runtype}{description=A parameter,value=1}
\setkeyword{param_1}{description=Another parameter,value=0}
\setkeyword{param_2}{name=\detokenize{PARAM_2},description=A third parameter,value=42}
\begin{document}
\section{Runtype 1 description}
\keywordtable{runtype,param_1}
\section{Runtype 2 description}
\keywordtable[name,value,description]{runtype,param_2}
\end{document}
