10

I want to study the source code of article.cls so I can create macros of my own. If anybody can tell me the location of article.cls document class file, that will be highly appreciated.

  • if your tex system is based on tex live, it should be located in TEXMF/tex/latex/base/article.cls, where TEXMF is the root directory of the tex live "library". – barbara beeton Feb 14 '17 at 3:14
  • 3
    try on Command line window kpsewhich article.cls, it would give the file path. Possible Duplicate of What is the quickest way to check whether I already have a given package? – texenthusiast Feb 14 '17 at 3:20
  • 1
    @texenthusiast Although the solution is the same, I think this really is a different question. – Alan Munn Feb 14 '17 at 3:24
  • 2
    @AlanMunn Yes I am not closing the question. Upvoted your comment, I agree. I tried to search a best closely linked question even before answering. – texenthusiast Feb 14 '17 at 3:30
  • The answer here will take you to the file, but for the code with comments you want classes.dtx or perhaps the full typeset source2e.pdf (texdoc source2e). – Joseph Wright Feb 14 '17 at 7:56
13

The easiest way to find any file in the TeX Distribution (if you know its name) is to use the kpsewhich program.

From the command line type:

kpsewhich article.cls

and it should return:

/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls

on a TeX Live system.

Depending on your OS, you may be able to open the file directly. On a Mac, e.g. I can type

open `kpsewhich article.cls` 

and the file will open in my normal TeX editor. (The back ticks pass the output of the command within the back ticks to the open command.) The equivalent Linux command is xdg-open I believe. I have no idea if an equivalent command exists in Windows.

  • You could also do vi `kpsewhich article.cls` to open it with a great editor. It doesn't really matter with which program you want to open it. – Johannes_B Feb 14 '17 at 6:24
  • 2
    @Johannes_B !wxqwqqqsw Oh I give up. – Alan Munn Feb 14 '17 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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