1

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.

  • 1
    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
0

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}

\begin{filecontents*}{AddSymbol.sty}
\ProvidesPackage{AddSymbol} [2016/04/13 V1.0]

\newcommand\AddSymbol[1]{%
  \ifcsname AddSymbol#1\endcsname%
    \csname AddSymbol#1\endcsname\else%
    \AtBeginDocument{Symbol: #1 unknown to AddSymbol\par}\fi%
}
\def\AddSymbolkreuz{\RequirePackage{wasysym}}
\def\AddSymbolLbag{\RequirePackage{stmaryrd}}
%
% CONTINUED LIST OF PACKAGES FOR EACH KNOWN SYMBOL
\endinput
\end{filecontents*}

\usepackage{AddSymbol}
\AddSymbol{kreuz}
\AddSymbol{foo}
\AddSymbol{Lbag}
\begin{document}
$ A \kreuz B \,\Lbag C$
\end{document}

enter image description here

  • Thanks Steven. (sorry for the late reply). I see what you mean about questioning its worth. Your input has been much appreciated – chiich Apr 19 '16 at 0:59

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.