POV-Ray : Newsgroups : povray.newusers : Math expressions in text : Re: Math expressions in text Server Time19 Aug 2022 19:47:08 EDT (-0400)
 Re: Math expressions in text
 From: Alain Martel Date: 5 Jan 2022 12:44:17 Message: <61d5d8f1@news.povray.org>

{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#61d5d8f1%40news.povray.org",
"headline": "Re: Math expressions in text",
"dateCreated": "2022-01-05T17:44:17+00:00",
"datePublished": "2022-01-05T17:44:17+00:00",
"author": {
"@type": "Person",
"name": "Alain Martel"
}
}
Le 2022-01-04 à 15:15, Subrahmanyam Pattamatta a écrit :
> Hello,
>
> I have recently started using POV-Ray for making illustrations/schematics for a
> material science research article. The figures came out really well. Thanks to
> POV-Ray developers.
>
> I wonder if there is a way to insert mathematical expressions as text into the
> figure (example: say latex symbols $\alpha + \beta = 0$) directly into the scene
> file or do I have to render the image in POV-Ray, save it to .png and later cut
> and paste latex equations into the .png file ?
>
> Thank you,
> Subrahmanyam Pattamatta
> Research Fellow
> University of Hong Kong
>

You may use a text object. You can't directly use \alpha and \beta, but
you can use the unicode code for those. Obviously, you need to chose a
font where the Greek alphabet is defined.

You can also create an image file showing your equation and apply it to
some object. Here, the simplest way is to have a box with an image_map
as pigment using the image :

box{0, <1, 1, 0.0001> pigment{image_map{png "equation.png"}} scale<20,
1, 1> translate Final_Location}

The image could be a jpeg or a gif if you want, just replace the «png»
with «jpeg» or «gif».
Change the name of the file to whatever name you are using.
Place the image file in the same folder as your scene file.
The image is initially mapped from <0,0>to <1,1>.
Then, you scale it according to how wide it is compared to it's height.
Finally, you can translate to wherever you want it to show up.

If you use a png file, you can have an alpha channel to make the
background transparent.