# Automatically identify the dependent package for LaTeX symbol command

Given a command like \kreuz, is it possible to create an application that will smartly recognise and import its dependent package wasysym, to enable its rendering out on a webpage?

The aim is to have such application render any symbols in the CTAN Comprehensive List, given the corresponding command.

Thanks.

• Welcome to the site. One problem is that some symbols have representations in multiple packages. For example, AMS and MnSymbol both have a \nsubseteq. – Steven B. Segletes Apr 6 '16 at 10:12
• it isn't clear what you intend here, in what way does knowing the package help put the symbol on a web page ? – David Carlisle Apr 6 '16 at 10:15
• In the Index of tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf is a list of most symbols which link you back to the section with the relevant package – user36296 Apr 6 '16 at 11:03
• @DavidCarlisle I'm currently receiving a bunch of LaTeX symbol commands which I'm trying to render unto the webpage, using either MathJax or KaTeX. However, this fails, which is what has raised my question. (Entering in the above symbol does NOT render out) --- is there an alternative method I can employ for this? – chiich Apr 12 '16 at 0:23
• @StevenB.Segletes I'm not sure I understand... do you mean that symbols of those packages have that prefix? – chiich Apr 12 '16 at 0:24

This approach is both easy and hard (and more trouble than it is worth, in my opinion). Hard because the user has to laboriously catalog the package associated with each symbol in a style file. But easy because each new symbol requires only a single line added to the AddSymbol.sty file, for example, \def\AddSymbolVdash{\RequirePackage{amssymb}}.

Then, in the preamble of your document, in addition to \usepackage{AddSymbol}, one needs to add \AddSymbol{\Vdash} in order to load the proper package, in this case amssymb.

In the MWE below, I actually create the stencil for AddSymbol.sty as part of a filecontents environment. It has error checking, if the symbol has not yet been defined.

\documentclass{article}
\usepackage{filecontents,etoolbox}

}
%
% CONTINUED LIST OF PACKAGES FOR EACH KNOWN SYMBOL
\endinput
\end{filecontents*}

$A \kreuz B \,\Lbag C$