(defun safe-latex-id (string)
(with-output-to-string (stream)
(iterate
(for char in-string string)
(case char
((#\& #\$ #\% #\# #\_ #\{ #\} #\^ #\\ )
(write-char #\- stream))
(t (write-char char stream))))))
Source Context