Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm looking for a way of making latex recognize the tick and cross symbols as apposed to having to use commands in latex code to make these symbols. Is there anything you can add in the preamble that supports the use of such characters?

The reason for this is that I'm generating a pdf and html document from the same source, so using commands unique to latex will mess up the formatting of my html doc.

Even still, I don't seem to be able to use the \checkmark command (after including the \usepackage{amsfonts}). I believe this because I'm using Sphinx - a tool that uses a mark up language of its own - to convert a document into latex format then pdf. I think it misses the \commandgoeshere bits when going from the markup to latex.

Thanks

Edit: Having spent some tome on it, it appears that the solution proposed below works perfectly. The problem is in fact to do with sphinx. When making these changes in the .tex file, the pdf that is generated produces the desired results. But when making the change to the preamble through the configuration file and then run make latexpdf an error gets thrown up relating to something (though it looks like nothing) in the latex.py file right in the guts of sphinx. But I guess this is to be discussed in a different post

share|improve this question

1 Answer 1

up vote 10 down vote accepted

This should do what you need:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{newunicodechar}
\newunicodechar{✓}{\checkmark}
\newunicodechar{✠}{\maltese}
\begin{document}

\Large ✓ \quad ✠

\end{document}

Here's the result

enter image description here

share|improve this answer
    
Pardon this question from someone relatively Unicode-ignorant: Why do I have to define these characters? Are they not included in utf8? Or is it just that the fonts used don't have these input characters assigned to the respective output characters? –  doncherry Jul 16 '12 at 13:57
1  
@doncherry: the option utf8 predefines only a subset of input chars. You can see the list if you look in the log-file – an normally you certainly wouldn't want to slow down the compilation only to get definitions you actually don't need.) –  Ulrike Fischer Jul 16 '12 at 14:05
1  
The utf8 option doesn't define a glyph for all Unicode characters. It just defines those present in the output encodings that are declared in the document. This was the main motivation for writing newunicodechar: extend the available range of glyphs without the need to rely on predefined output encodings. –  egreg Jul 16 '12 at 14:06
    
@doncherry Thanks for the quick reply. I included the preamble bits you described (though I'm not using the article doc class), but was given this error: Exception occurred: File "/Library/Python/2.7/site-packages/Sphinx-1.1.3-py2.7.egg/sphinx/writers/latex.p‌​y", line 266, in astext self.generate_indices() + UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 703: ordinal not in range(128). Any advice? –  user1488804 Jul 16 '12 at 14:20
    
@user1488804 Sorry, I don't know about Sphinx. –  egreg Jul 16 '12 at 14:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.