4

I am creating an app that shows off some formulas I pre-render with latex on sharelatex.com. ShareLatex gives me the documents as vector pdf's, but I have a problem.

Here are some examples of what I have(Yay basic physics): enter image description here enter image description here

and as you can see, there images does not have the same font size, which makes them look bad on a device when placed next to each other (because they're really uneven) Here is my .tex:

\documentclass[border=5pt]{standalone} %Else some of the characters gets cut off
\usepackage{courier}
\fontsize{10pt}{12pt}\selectfont
\begin{document}

$f=\frac{c}{\lambda}$

\end{document}

The question is: How can I get my latex document formulas to always have the same, fixed, font size, no matter the size of the formula? If not, how can I get a transparent document/no borders, so I can know the original size of the document and up/downscale them after that to fit them to the same size?

  • Side note: If it did not come clear from my noob question: I don't know a lot about tex. – Oscar Apeland Jan 23 '14 at 9:45
  • I think the font size is the same, only the size of the resulting PDF is different. If you use a fixed page width, the apparent font size will be the same. – Stephan Lehmke Jan 23 '14 at 13:38
  • @StephanLehmke The formulas are of different length, wouldn't fixed width just compress it at times? There might be a really obvious answer to this question, I just can't seem to figure out how I can get each equation to be equally big on my device. – Oscar Apeland Jan 23 '14 at 13:44
  • If you want all formulas to have the same font size, then obviously there has to be a longest equation which can be displayed (unless it is possible to scroll horizontally). The width of this longest equation is the fixed paper width you have to select. Of course, if the font size is to be the same for all equations, then all shorter equations will have some white space to the sides. – Stephan Lehmke Jan 23 '14 at 15:11
  • 1
    @StephanLehmke You were right, it was that simple. NSNumber * max = [biggestPDFArray valueForKeyPath:@"@max.self"]; float scaleBy = 320/max.floatValue; float width = originalWidth*scaleBy; – Oscar Apeland Jan 24 '14 at 8:47
3

You can use \DeclareMathSizes to fix math font size. For instance,

\makeatletter
\DeclareMathSizes{\@xpt}{\@xpt}{\@xpt}{\@xpt}
\makeatother

in the preamble will set math text size, math script size, and math scriptscript size to be the same if you are using default font size (10pt).

For the second question, I believe standalone class provides option to output transparent png image utilizing ImageMagick. See page 15 of the package document for more detail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.