Text FormattingWhat to use instead of textcomp package?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

What to use instead of textcomp package?

Post by insipidtoast »

The latex tutorial I'm reading says to use textcomp to make degrees centigrade symbols, euros, etc. However, http://www.ctan.org/pkg/textcomp
the CTAN website says it's obsolete, and I'm having trouble downloading it.

In lyx \textdegree does not generate the degree symbol because I obviously don't have the right package enabled in the preamble.
Last edited by cgnieder on Mon Sep 10, 2012 11:45 pm, edited 1 time in total.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

What to use instead of textcomp package?

Post by localghost »

insipidtoast wrote:[…] the CTAN website says it's obsolete, and I'm having trouble downloading it. […]
I can't see where it's said that the package is obsolete. And a download and installation by hand is not needed since the package is a standard part of your TeX distribution.


Thorsten
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

What to use instead of textcomp package?

Post by insipidtoast »

30 \textcelsius{}
%produces an error every time. I don't know why the tutorial says to type that!??!
30 \textdegree{}C
% Since this is the correct way to produce the temperature symbol for centigrade.

\textcelsius %does not work.
Last edited by cgnieder on Mon Sep 10, 2012 11:33 pm, edited 1 time in total.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: What to use instead of textcomp package?

Post by localghost »

It goes without saying that you have to load the package. Please don't ask me how to do that in LyX. And what is this tutorial you are talking about?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

What to use instead of textcomp package?

Post by Stefan Kottwitz »

This simple document works without problems, containing the line you mentioned:

Code: Select all

\documentclass{article}
\usepackage{textcomp}
\begin{document}
30 \textcelsius{}
\end{document}
Also in LyX, you can load a package by adding

Code: Select all

\usepackage{textcomp}
to the LaTeX preamble via the menu Document / Settings. I just guess you might have forgotten it.

Stefan
LaTeX.org admin
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

What to use instead of textcomp package?

Post by insipidtoast »

No, I already had that package loaded into the preamble.

\textcelsius{} %actually worked this time! I probably spelled it wrong the other time.
Last edited by cgnieder on Mon Sep 10, 2012 11:34 pm, edited 1 time in total.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

What to use instead of textcomp package?

Post by insipidtoast »

\textdegree{}C %works better, because it looks the same as the result from entering:

\textdegree{}F

\textcelsius{} %looks different
Last edited by cgnieder on Mon Sep 10, 2012 11:35 pm, edited 1 time in total.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: What to use instead of textcomp package?

Post by Stefan Kottwitz »

So I guess the problem is solved - correct?

The error is gone and you found a consistent symbol. Btw. textcomp is not obsolete, it's just not distributed as extra package any more since it's distributed with the basic LaTeX.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

What to use instead of textcomp package?

Post by cgnieder »

In general I would advice to use siunitx for any kind of units. You'll get consistent spacing and consistent looks of all number-unit combinations.

Code: Select all

\documentclass{article}
\usepackage{siunitx}
\DeclareSIUnit{\fahrenheit}{\degree F}
\begin{document}
\SI{30}{\celsius}
\SI{99.9}{\fahrenheit}
\end{document}
Regards
site moderator & package author
Post Reply