add the javascript into the macro for latex instead of relying on it being there globally. For #91