How do I change the font of the mathematical symbols in the figure in the overleaf file?

18 vues (au cours des 30 derniers jours)
The package that I have used in my overleaf file for the mathematical equations and symbols is
\usepackage[cal=boondoxupr,
calscaled=.94,
bb=libus,
frak=mma,
frakscaled=.97,
scr=zapfc]{mathalpha}
.
So for lowercase letters I am using \mathcal and for uppercase \mathscr. But how do I change the font style of the symbols in the figures, which are in eps format, that I have obtained from matlab?

Réponse acceptée

Piyush Patil
Piyush Patil le 29 Mar 2023
Hello Saurabh,
You can change the font style of symbols in figures that are in EPS format in LaTeX, using the "psfrag" package. This package allows you to replace text in an EPS figure with LaTeX typeset text, including mathematical symbols, and change their font style.
Here are the steps to use "psfrag" package in your LaTeX document -
1. Load "psfrag" package into your LaTeX document:
\usepackage{psfrag}
2. Export your MATLAB figure to EPS format:
print -depsc myFig
3. Copy the eps file "myFig.eps" into the same folder as your "main.tex" file.
4. Click on the Overleaf menu icon above the file list panel, and make sure the "Compiler" setting is set to "LaTeX".
5. Include the EPS figure into your LaTeX document using "\includegraphics" command:
% including myFig.eps file into LaTex document
\includegraphics{myFig}
6. You can now use "\psfrag" command to change the font style of the symbols in the figure. For example, you have a graph with x-axis labelled as "Time" and y-axis labelled as "Amplitude". You can change the font of these symbols as follows:
% psfrag setup
% changing font style of symbols
\psfrag{Time}{{\fontfamily{lmr}\selectfont Time}}
\psfrag{Amplitude}{{\fontfamily{lmr}\selectfont Amplitude}}
In this code, the "\fontfamily" command specifies the font family you want to use for the symbol (in this case, "lmr" for Latin Modern Roman), and the "\selectfont" command selects that font.
Refer to this sample code -
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{psfrag}
\begin{document}
\begin{figure}
\centering
% psfrag setup
% changing font style of symbols
\psfrag{Time}{{\fontfamily{lmr}\selectfont Time}}
\psfrag{Amplitude}{{\fontfamily{lmr}\selectfont Amplitude}}
% including myFig.eps file into LaTex document
\includegraphics{myFig}
\caption{My eps figure}
\label{fig:myfigure}
\end{figure}
\end{document}
You can also refer to the following link for additional information about "psfrag" usage - https://www.overleaf.com/latex/examples/psfrag-example/tggxhgzwrzhn

Plus de réponses (0)

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by