Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have basic class file and I would like to set margins of an a4paper to 0mm. Here is the markup of some-class.cls:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{some-class}[2013/07/29]

\renewcommand{\normalsize}{\fontsize{10pt}{12pt}\selectfont}
\DeclareOption{a4paper}{
    \setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}
}
\DeclareOption{landscape} {
    \setlength\@tempdima   {\paperheight}%
    \setlength\paperheight {\paperwidth}%
    \setlength\paperwidth  {\@tempdima}
}

%Default options for design
\ExecuteOptions{a4paper}
%Process user given options
\ProcessOptions

\RequirePackage[top=0mm, bottom=0mm, left=0mm, right=0mm, textwidth=210mm]{geometry}

Content of my document.tex:

\documentclass[]{some-class}
\author{roncsak}
\title{some title}
\date{2013/07/28}
\begin{document}
Lorem ipsum
\end{document}

I would like to set an A4 paper with zero margins. Instead I notice some margin on the left side (approximately 10mm). I could reduce that margin with the \RequirePackage[top=0mm, bottom=0mm, left=-10mm, right=0mm, textwidth=210mm]{geometry} but I would like to understand why this margin left behind.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The most basic approach to obtain a zero-width margin is to use

\usepackage[margin=0pt]{geometry}% http://ctan.org/pkg/geometry

(or \RequirePackage within a class/package). The sets the margins and indirectly also the text block size.

The "margin" you notice is due to the paragraph indent that is set by default to 20pt. Add \noindent to a paragraph to remove this indent, or set it to zero in the preamble using \setlength{\parindent}{0pt} which will make the change global.

share|improve this answer
    
The \setlength{\parindent}{0pt} worked well! Thank you! –  roncsak Jul 29 '13 at 18:59
    
@roncsak: Don't forget to set a non-zero \parskip (or load the package parskip) if you set \parindent to 0. –  You Jul 29 '13 at 20:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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