[Tex/LaTex] How create a paper of x,y dimensions size

paper-sizestandalone

How can I create a paper of A1 size on latex? Or a x,y (in centimeters) dimensions paper?

In \documentclass looks like there isn't this option. I need use the \documentclass{standalone} package too (to print out some formulas).

I would like create a paper with dimensions of x and y centimeters. Could be a paper of A1 size (Wikipedia) too, I think will works fine to me.

I have fond this link but I can't change the \documentclass.

For other users interested

How to generate a standalone equation (formula) using latex without background and with a specified dimension?

With these code below (Bayes_theorem.tex)

\documentclass{standalone}

\usepackage[left=0cm,top=0cm,right=0cm,nohead,nofoot]{geometry}
\usepackage{varwidth}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{amsmath, amssymb, graphics, setspace}
\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}[1]{{}}
\newcounter{mathematicapage}

\geometry{
paperwidth=12cm,
paperheight=30cm,
margin=0cm
}
\begin{document}\sloppy
\begin{equation*}
\resizebox{1.0 \textwidth}{!} 
{
$
  P\left(H_h|E_e\right)=\frac{P\left(E_e|H_h\right)P\left(H_h\right)}{P\left(E_e\right)}
$
}
\end{equation*}

\end{document}

, run:

$pdflatex Bayes_theorem.tex

then

$convert -geometry 4800x -density 4000 Bayes_theorem.pdf -quality 90 Bayes_theorem.png

And this beatifull formula without background will appear:

Bayes_theorem

This was possible with the help of several community users helping me in this question itself and these others 1, 2.

Thanks so much.

Best Answer

You should use the geometry package:

enter image description here

Notes:

  • \sloppy used to loosen the spacing requirements to work for a smaller width without overflowing into margin. Should not be needed in your actual document. See Why is text being placed beyond the specified line width?
  • [showframe] option used to display the margins
  • To see the layout also try \usepackage{layout} and add \layout after the begin{document}.

Code:

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{lipsum}

\geometry{
paperwidth=6cm,
paperheight=4cm,
margin=0.5cm
}
\begin{document}\sloppy
\lipsum[1]
\end{document}
Related Question