2

I wanted to write a line that must be 250 mm from the top and should be at 50 mm from the left side, to do that following is my code.

I have used \vspace* to get the margin from top at the start of the page and \hspace to get a horizontal margin.

    \documentclass[12pt]{article}
    \usepackage[utf8]{inputenc}

    \usepackage[a4paper, margin = 0in]{geometry}

    \begin{document}
          \vspace*{250mm} % using to get a margin from top
          \hspace{50mm} I am at 250 mm from Top and 50 mm from left side.
    \end{document}

Which is giving me the below output.

The text is 250 mm from the top but leaves a margin of an extra 10 mm from the left side, i.e. a total of 60 mm margin from the left side.

LaTeX Image

2
  • 6
    \noindent\hspace{50mm}
    – egreg
    Jul 29, 2022 at 12:41
  • Thanks! will it also remove the space between \hspace{} and I? I have not checked it.
    – Pushpendra
    Jul 31, 2022 at 17:25

1 Answer 1

6

You have three spaces, an indentation from the start of a paragraph (actually a box not a space), the 50mm space, then a variable word-space coming from the space token you added between \hspace{} and I

\showoutput will show:

...\glue(\baselineskip) 6.16669
...\hbox(8.33331+2.33331)x597.50787, glue set 161.76242fil
....\hbox(0.0+0.0)x17.62482                  % paragraph indent
....\glue 142.26378                          % requested space
....\glue 3.91663 plus 1.95831 minus 1.30554 % inter-word space
....\OT1/cmr/m/n/12 I
....\glue 3.91663 plus 1.95634 minus 1.30684
....\OT1/cmr/m/n/12 a
....\OT1/cmr/m/n/12 m
3
  • Will \noindent\hspace{50mm} (as suggested by @egreg above) remove the third space (between \hspace{} and I)?
    – Pushpendra
    Jul 31, 2022 at 17:24
  • @Pushpendra No, you need to not add the space. In a real document you should almost never have vspace or hspace so this hardly ever a problem in practice Jul 31, 2022 at 17:54
  • Thank you so much.
    – Pushpendra
    Jul 31, 2022 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .