Is there a degree symbol in LaTex or is ^{\circ} the best it can do?
240 views (last 30 days)
Show older comments
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: https://www.mathworks.com/matlabcentral/answers/42448-about-latex-command-in-the-title, 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')
Result:
Bin 0° <= \varphi_2 <= 5°
1 Comment
Stephen23
on 12 Dec 2018
Edited: Stephen23
on 25 Aug 2020
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.
Accepted Answer
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}$$
4 Comments
Cris LaPierre
on 12 Dec 2018
They are the unicode values for what you see in the title (the \leq and \phi).
More Answers (2)
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.
\documentclass{report}
\usepackage{siunitx}
- Start the document.
\begin{document}
- For example:
Degree symbol: 90\si{\degree}
\end{document}
- 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.
\documentclass{report}
\usepackage{gensymb}
- 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.
\documentclass{report}
\usepackage{textcomp}
- We are again creating a new document.
\begin{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.
2 Comments
Rik
on 4 Sep 2019
Adding packages to the LaTeX interpreter in Matlab is so far from trivial that it demands some instructions.What you have provided would be a good answer on a LaTeX forum, but it doesn't explain how to use this information in Matlab.
I will leave the choice to you, but I would suggest a major edit of your answer or a deletion.
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.
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 }
3 Comments
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!