Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use pst-eucl package and I am not so happy with the names defined for its keys (because the names are difficult to remember). I want to rename some of the keys for my own purpose by creating a new package wrapping the package. For example, I want to rename:

  • PtNameMath to PointLabelMath.
  • PointNameSep to PointLabelSep.
  • PosAngle to PointLabelAngle.
  • PointName to PointLabel.

Could you show me the new package wrapping pst-eucl with renamed keys above.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Just define the new keys copying the action of the old ones:

\makeatletter
\define@key[psset]{pst-eucl}{PointLabelMath}[false]{\@nameuse{Pst@PtNameMath#1}}
\define@key[psset]{pst-eucl}{PointLabelSep}{\edef\psk@PointNameSep{#1}}
\define@key[psset]{pst-eucl}{PointLabelAngle}{\edef\psk@PosAngle{#1}}
\define@key[psset]{pst-eucl}{PointLabelAngleA}{\edef\psk@PosAngleA{#1}}
\define@key[psset]{pst-eucl}{PointLabelAngleB}{\edef\psk@PosAngleB{#1}}
\define@key[psset]{pst-eucl}{PointLabelAngleC}{\edef\psk@PosAngleC{#1}}
\define@key[psset]{pst-eucl}{PointLabel}{\def\psk@PointName{#1}}
\define@key[psset]{pst-eucl}{PointLabelA}{\def\psk@PointNameA{#1}}
\define@key[psset]{pst-eucl}{PointLabelB}{\def\psk@PointNameB{#1}}
\define@key[psset]{pst-eucl}{PointLabelC}{\def\psk@PointNameC{#1}}
\define@key[psset]{pst-eucl}{PointLabelSep}{\edef\psk@PointNameSep{#1}}
\makeatother

If you want to write a new package, say pst-eucl-mod.sty, it should have the following shape:

\ProvidesPackage{pst-eucl-mod}
\RequirePackage{pst-eucl}
\define@key[psset]{pst-eucl}{PointLabelMath}[false]{\@nameuse{Pst@PtNameMath#1}}
\define@key[psset]{pst-eucl}{PointLabelSep}{\edef\psk@PointNameSep{#1}}
\define@key[psset]{pst-eucl}{PointLabelAngle}{\edef\psk@PosAngle{#1}}
\define@key[psset]{pst-eucl}{PointLabelAngleA}{\edef\psk@PosAngleA{#1}}
\define@key[psset]{pst-eucl}{PointLabelAngleB}{\edef\psk@PosAngleB{#1}}
\define@key[psset]{pst-eucl}{PointLabelAngleC}{\edef\psk@PosAngleC{#1}}
\define@key[psset]{pst-eucl}{PointLabel}{\def\psk@PointName{#1}}
\define@key[psset]{pst-eucl}{PointLabelA}{\def\psk@PointNameA{#1}}
\define@key[psset]{pst-eucl}{PointLabelB}{\def\psk@PointNameB{#1}}
\define@key[psset]{pst-eucl}{PointLabelC}{\def\psk@PointNameC{#1}}
\define@key[psset]{pst-eucl}{PointLabelSep}{\edef\psk@PointNameSep{#1}}
\endinput

The source can be found in the file pst-eucl.tex, if you want other names.

This new package doesn't accept the old option that can be passed to pst-eucl, I believe you don't need it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.