Is there a degree symbol in LaTex or is ^{\circ} the best it can do?

267 views (last 30 days)
Zhangxi Feng
Zhangxi Feng on 11 Dec 2018
Commented: Rik on 25 Aug 2020
I have searched quite a bit for examples of displaying titles in latex. My goal is to show the following:
Bin 0° <= \varphi_2 <= 5°
Where \varphi is the variation of phi that normal TeX does not offer. I do not mind if the less than or equal to stays like that or becomes the fancy LaTeX form.
The example I found so far that does not give me any warning is from:, where the example is:
title('$$Q \geq \frac{I_h H}{I_h H+I_z C}, b_1 \geq b_2$$','interpreter','latex')
And it works as expected when I tried it.
I tried many things and eventually the following worked:
title('Bin $$0^{\circ} \leq \varphi_2 \leq 5^{\circ}$$','interpreter','latex')
Bin 0° <= \varphi_2 <= 5°
But as this post [link] pointed out, using the circle seems less sophisticated than being able to use the proper degrees symbol. So is there a way to add a degrees symbol into my line? I have tried typing the symbol directly or try a concat string with char(176), but I couldn't make either work.
  1 Comment
Stephen23 on 12 Dec 2018
LaTeX by itself cannot create an actual degree character, instead faking it with circles and the like. The actual solution when using LaTeX to generate documents is to use a package such as gensymb or textcomp:
But this approach does not work within MATLAB: sadly there does not seem to be a good solution.

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 11 Dec 2018
Edited: Walter Roberson on 12 Dec 2018
I don't think it's possible to have both the degree symbol and LaTeX. Playing around with the title in the property inspector, I can combine strings with LaTeX, and can add \char126 or ^^7a and see the changes. However, if I add \char176 or ^^b0 it does not display the inserted character (though the LaTeX formatting remains).
The final thing I can do is copy and paste the degree symbol into the title string. It appears, but kills the ability to use the LaTeX interpreter, even if I put it outside the $$ flagged LaTeX expression
Bin 0° $$ \leq \varphi_2 \leq 5^{\circ}$$
displays as
Bin 0° $$ \leq \varphi_2 \leq 5^{\circ}$$
Cris LaPierre
Cris LaPierre on 12 Dec 2018
They are the unicode values for what you see in the title (the \leq and \phi).
You can see more about why the \x here.

Sign in to comment.

More Answers (2)

Erick Zind
Erick Zind on 4 Sep 2019
Many people use many mathematical symbols on LaTeX. One of them is the symbol of degree. Now in this article we will explain how to use the degree symbol on LaTeX. You will be able to add the degree symbol with various packages via LaTeX. Let's start!
Three different LaTeX packages:
1- Using Siunitx package
  • We add this package first to our service. Then follow the steps below.
  • Start the document.
  • For example:
Degree symbol: 90\si{\degree}
  • We give a like request.
We print out 90°.2- Using gensymb package
  • We will print the degree symbol using another package, gensymb.
  • First of all, we are loading our package again.
  • Then begin the new document.
  • Then type your sentence. For instance,
The right angle is \ang{90}.
  • It will give us such a result.
The right angle is 90°.
3- Using textcomp package
  • As another method, let's get to know the last textcomp.
  • As in the examples above, we load our package first.
  • We are again creating a new document.
  • And we write the result in the format of the degree we want, for example
The round angle is \ang{360}.
  • It will give us such a result.
The round angle is 360.
Walter Roberson
Walter Roberson on 4 Sep 2019
I gather that the Report Generator provides a way to insert arbitrary latex including adding packages, but MATLAB itself makes it pretty rough, with a binary encoded configuration file that no-one seems to know how to decompile.

Sign in to comment.

Afzal khan
Afzal khan on 25 Aug 2020
Yes there a degree symbol in LaTex
Why should I use Latex?
With other more conventional alternatives for producing documents, such as Microsoft’s Word, it is natural to wonder why one should take the trouble to learn to use Latex. On the surface, one of the advantages of Latex is the professional quality of the documents that you can generate. This is particularly true for documents that contain formulas or equations, but Latex has many applications beyond mathematics. Documents on chemistry, physics, computing, biology, law, literature, music, and any other topic you can think of can still take advantage of Latex’s excellent print quality. Below is Latex degree symbol code.
\ documentclass [10pt, a4paper] { article }
\ usepackage [utf8] { inputenc }
\ usepackage [francais] { babel }
\ usepackage [T1] { fontenc }
\ usepackage { textcomp }
\ usepackage { amssymb }
\ DeclareTextSymbol { \ deg } { T1 } { 6 }
\ DeclareTextSymbol { \ deg } { OT1 } { 23 }
\ usepackage[left = 4cm, right = 4cm, top = 4cm, bottom = 4cm] { geometry }
\ begin { document }
\ degre C et \ degres C et \ deg C
\ end { document }

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!