Is there a degree symbol in LaTex or is ^{\circ} the best it can do?
Ältere Kommentare anzeigen
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 Kommentar
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.
Akzeptierte Antwort
Weitere Antworten (2)
Erick Zind
am 4 Sep. 2019
0 Stimmen
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 Kommentare
Rik
am 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
am 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
am 25 Aug. 2020
0 Stimmen
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 Kommentare
Rik
am 25 Aug. 2020
Same comment as above: adding LaTeX packages is very hard in Matlab, so this answer is next to useless without that part. Simply copying a general LaTeX guide is not enough for a solution on this forum as Matlab has unique requirements that programs like TeXmaker don't have.
Walter Roberson
am 25 Aug. 2020
Link seems to be defunct
Rik
am 25 Aug. 2020
Odd, the link works for me.
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
