Site Tools


kpsewhich

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
kpsewhich [May 17, 2026 at 15:17] – created Ivan Janevskikpsewhich [May 17, 2026 at 15:33] (current) Ivan Janevski
Line 1: Line 1:
 # kpsewhich # kpsewhich
-**kpsewhich** is a command +**kpsewhich** is a LaTeX-related command. It's a diagnostic command that's used to look up the full path of a file you know the LaTeX compiler would use implicitly. In some way, it is similar to the `which` command, which shows the full path of a command if you would run it in the shell (e.g. `which ls` shows `/usr/bin/ls`).
  
 +For example, when you use `\documentclass{article}` in a TeX document, and you compile the document with `pdflatex`, the compiler is going to load the "document class: article" from `article.cls` file (Note: the `.cls` extension stands for "class")
 +```latex
 +% Compile: pdflatex main.tex
 +% Result:  main.pdf 
 +\documentclass{article}
 +\begin{document}
 +...
 +\end{document}
 +```
  
-## Help +Where `article.cls` located? You can find out with `kpsewhich` command! 
-Running `kpsewhich --help`+``` 
 + $ kpsewhich article.cls 
 +/usr/share/texmf-dist/tex/latex/base/article.cls 
 +``` 
 + 
 +## Run 
 + 
 +### No arguments 
 +You can't run it without arguments. 
 +``` 
 + $ kpsewhich 
 +Missing argument. Try `kpsewhich --help' for more information. 
 +``` 
 + 
 +### Non-existent file 
 +If you put something nonsensical it's just going to return nothing. 
 +``` 
 + $ kpsewhich fdsafdsafdsa 
 +```
  
 +### Help
 ``` ```
 + $ kpsewhich --help
 Usage: kpsewhich [OPTION]... [FILENAME]... Usage: kpsewhich [OPTION]... [FILENAME]...
  
kpsewhich.1779031076.txt.gz · Last modified: by Ivan Janevski