I want to create a note about PSTricks and I need macros to typeset syntax in more conventional way that is adopted by most computer scientists. For example, I need a pair of >
and <
but they must be slimmer than the usual ones. Here I used \guillemotright
and \guillemotleft
as I could not find the better ones.
Here is my MWE, could you help me to accomplish my objective? Best practice is also welcome!
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\def\guillemetright{\guillemotright}% from now on we must hide the wrong terms.
\def\guillemetleft{\guillemotleft}% from now on we must hide the wrong terms.
\def\gr{\guillemetright}%I need a single > but not as big as the usual >.
\def\gl{\guillemetleft}%I need a single < but not as big as the usual <.
\newcommand\com[1]{\textbf{\textbackslash #1}}
\newcommand\opt[1][\textit{kv-options}]{\textcolor{blue}{[\gl\ensuremath{#1}\gr]}}
\newcommand\man[1]{\textcolor{red}{\{\gl\ensuremath{#1}\gr\}}}
\begin{document}
\section{Projection}
\fbox{\com{pstProjection}\opt\man{A}\man{B}\man{P_1,\ldots,P_n}\opt[P_1',\ldots,P_n']}
\noindent will project orthogonally the point $P_i$ on the line $\overline{AB}$.
\end{document}
Note: \man
(mandatory) in red, \opt
(optional) in blue, \com
(command) in black.
listings
package to automate the highlighting of different portions. – Peter Grill Mar 15 '12 at 15:45listing
thoroughly. I will compare and might use your suggestion. – kiss my armpit Mar 15 '12 at 15:47