How to install a .sty package that is missing when a tex file is being built by Texstudio for Ubuntu 20.04? Any method would work for me, but preferably a method via terminal or preamble of the tex file would be the most useful.
mathcomp seems to just provide some symbols to write units. Nowadays the latex standard is to use the
siunitx package instead.
texlive-latex-recommended from Ubuntu. Ubuntu splits TeXLive into several Ubuntu packages (not to be confused with LaTeX packages, they often contain many latex packages). Given that
mathcomp is not a widely used package it is unlikely that it is listed in
texlive-latex-recommended, might be easier to just install it all
texlive-all I think it is called(?)
Personally I don't use TeXLive from Ubuntu as I'd like to get the latest updates so I use the upstream one (see http://tug.org/texlive).
If you use Ubuntu and the TeXLive that Ubuntu provides the way you figure out which Ubuntu package a given latex package belongs to is to make sure you have
sudo apt install apt-file sudo apt-file update
Run the latter command from time to time.
Then search a latex package via for example
apt-file search mathcomp.sty
and here it tells me
so I would need to install