[Tex/LaTex] How to auto adjust a equation to appear in the entire page? (Scale to equations, is this exist?)


If I have a document like this:

\documentclass[landscape, 12pt]{report}



\usepackage{amsmath, amssymb, graphics, setspace}

\begin{document}    \begin{equation}\label{Equation:Naive_Bayes_Classifier}
    P\left(H_h|E_1,E_2,\ldots ,E_e,\ldots    E_{\mathbb{E}}\right)=\frac{P\left(H_h\right) P\left(E_1|H_h\right)    P\left(E_2|H_h,E_1\right) \text{$\ldots $P}
    \left(E_e|H_h,E_1,E_2,\ldots ,E_{e-1},E_{e+1} \ldots, E_{\mathbb{E}}\right) \text{$\ldots    $P}
    \left(E_{\mathbb{E}}|H_h,E_1,E_2,\ldots ,E_{\mathbb{E}-1}\right)}{ P\left(E_1,E_2,\ldots,E_e, \ldots    ,E_{\mathbb{E}}\right)}

How can I auto adjust this equation to appear in the entire page, using all horizontal space? (Without badboxes or smaller than the width of the page?)

If is there a kind of scale to use in equations, giving explicity how greater the equation should become, this solver my problem too.

Best Answer

To "scale" an equation to fit a box you can use \resizebox from the package graphicx. Below is a stripped example of your code that does what you are looking for.

\documentclass[landscape, 12pt]{report}

\noindent Here is some text
\resizebox{.9 \textwidth}{!} 
    $ a + b $
and here is some more.

Here the .9 determines how much of the width you'd like to take up, in this case I choose 90% though you can fit to your liking. The ! as the second argument will preserve the aspect ratio.

Giving credit where it is due, a very similar question was answered on Stack Exchange recently about shrinking the equation. In both cases the \resizebox should suffice, though it is not recommended. Personally, I would consider splitting the equation. Having an inconsistent math font size can be a typographical nightmare.


Here the argument to \resizebox is set to 1.0 \textwidth (compiled with pdflatex):

Example 1

In this example it is set to 0.2 \textwidth

Example 2

Related Question