Skip to content

Instantly share code, notes, and snippets.

@ebrahimebrahim
Created October 19, 2022 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebrahimebrahim/c7089072cce35d7e45f6e2b3a8923a7f to your computer and use it in GitHub Desktop.
Save ebrahimebrahim/c7089072cce35d7e45f6e2b3a8923a7f to your computer and use it in GitHub Desktop.
install cambria math and times new roman fonts on ubuntu
# some annoying document formatting requirements made me to this in tex:
# \setmathfont{Cambria Math}
# \setmainfont{Times New Roman}
# and of course these microsoft fonts are not found when compiling with xelatex on ubuntu
# this gist helps set up the texlive environment in ubuntu to find the fonts
# thanks to maxwelleite: https://gist.github.com/maxwelleite/10774746
# their script is way better and more automated, but I didn't want to sudo an entire script,
# so below I have extracted the commands I want and made it clear where sudo is needed
# I recommend running the below one by one to check that each step works
# --- install cambria math and other stuff ---
# acquire fonts
mkdir tmp_workspace
cd tmp_workspace
sudo apt install cabextract fontforge
wget https://web.archive.org/web/20171225132744/http://download.microsoft.com/download/E/6/7/E675FFFC-2A6D-4AB0-B3EB-27C9F8C8F696/PowerPointViewer.exe
cabextract -t PowerPointViewer.exe
cabextract -F ppviewer.cab PowerPointViewer.exe
cabextract -L -F '*.tt?' ppviewer.cab
fontforge -lang=ff -c 'Open("cambria.ttc(Cambria)"); Generate("cambria.ttf"); Close(); Open("cambria.ttc(Cambria Math)"); Generate("cambriamath.ttf"); Close();'
# install them
sudo mkdir -p /usr/share/fonts/truetype/vista
sudo cp *.ttf /usr/share/fonts/truetype/vista/
# clean up
fc-cache -f /usr/share/fonts/truetype/vista/
cd ..
rm -rf tmp_workspace
# --- install Times New Roman and other stuff ---
sudo apt install ttf-mscorefonts-installer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment