16

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.

Jiapan
  • 731

2 Answers2

21

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.

Alan Munn
  • 218,180
0

I have idea where all document class files reside in windows os, if your operating system windows, MikTex Compiler then check here,

C:\Users\Admin\AppData\Local\Programs\MiKTeX\tex\latex\base

Here, you can view all base document classes like

article.cls,article.sty,report.cls,report.sty,letter.cls,letter.sty

Source code will be inside article.cls. article.sty is the latest file format .cls file is loaded actually inside .sty file.