TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In C#, we can specify certain properties of a class to be private, read only, etc. I want to apply this methodology in writing LaTeX document class if it is possible.

I can find articles pertaining to it neither on the internet nor in a book.

The following is my simplified document class.

\ProvidesClass{pst-xport}[a cute document class for my own purpose.]
% .... others ....




% it must be private

    % .... others ....

% .... others ....

% it must be private

%%%% INTERFACES %%%%




We use this document class as follows.



% \parindent must not be accessible in this input file.

% \PictureWidth must not be accessible in this input file.

    I can find a tool to convert
    PDF to EPS in my neither
    bathroom nor kitchen.


If it is possible, how to make certain macros defined in a document class inaccessible from outside?

share|improve this question
I don't think there is a way to make truly private methods per se, but you are aware of the way @ works, right? It is override-able but is standardly used to make macros unavailable in normal documents. tex.stackexchange.com/questions/8351/… – kgr Jul 27 '11 at 18:23
up vote 12 down vote accepted

You can't make macros totally inaccessible from "outside". Even the TeX primitives are not protected and can be redefined (their names, not their function). You can only give your macros a very special name to avoid accidental and hinder deliberate changes on them.

Usually internal macros which are not supposed to be changed by other code include an @ which is normally not allowed as part of a macro name. This can be changed using \makeatletter and changed back to normal with \makeatother. Also such internal macros of one package should start with an specific prefix which is normally build from the package name. So instead of naming an internal macro \foobar call it \xport@foobar. This won't protect it from some users which really want to change it, but they can consider themselves warned.

share|improve this answer

Also, you might want to explore expl3 (part of LaTeX3), which has its own naming conventions (quite distinct from plain TeX's and LaTeX2's @).

share|improve this answer

Your Answer


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.