[Tex/LaTex] How to set margins and page size in pdfLaTeX without geometry

geometrypaper-sizepdftextex-core

What is the TeX equivalent of

\usepackage[paperwidth=10cm, 
            paperheight=15cm,
            margin=0mm,
            bottom=1mm]{geometry}

?

I know nothing in TeX and so far, I am playing with expressions such as

\newlength{\initialVerticalHeight}
\setlength{\initialVerticalHeight}{5cm}

\newlength{\bottomMargin}
\setlength{\bottomMargin}{1mm}

\global\setlength\paperheight\initialVerticalHeight%
\global\setlength\pdfpageheight\initialVerticalHeight%
\global\setlength\textheight{\dimexpr\paperheight-\bottomMargin}%

but I can't find the equivalent of left(margin) and top(margin).

Is it very complicated? I'm trying to avoid using geometry package because I'm doing tricky things and want to have a clear understanding of what is happening.

Best Answer

Here is a solution

\documentclass{article}
\usepackage{lipsum}

\newlength{\bottomMargin}
\setlength{\bottomMargin}{1mm}

% paper size
\setlength{\paperwidth}{10cm}
\setlength{\paperheight}{15cm}
\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}
% horizontal dimensions
\setlength{\oddsidemargin}{-1in}
\setlength{\evensidemargin}{\oddsidemargin}
\setlength{\textwidth}{\paperwidth}
% vertical dimension
\setlength{\topmargin}{-1in}
\setlength{\headheight}{0pt}
\setlength{\headsep}{0pt}
%\setlength{\topskip}{10pt}   if you are about new class
%\setlength\footskip{30pt} if you want a footer, here no place for footer
\setlength{\textheight}{\paperheight}
\addtolength{\textheight}{-\bottomMargin}



\begin{document}
\lipsum
\end{document}

Latex format set \topskip=10pt standard class set it 10pt, 11pt ,12pt. It should never be set 0pt

Note number of lines in the page is also factor in the text height or the bottom magin.