Let's see what happens.
By default, LaTeX sets paper size to US letter. If I only add to your example, after \begin{document}
,
\showthe\paperwidth
\showthe\textwidth
\showthe\oddsidemargin
the console shows
> 614.295pt.
l.8 \showthe\paperwidth
?
> 500.484pt.
l.9 \showthe\textwidth
?
> -15.36449pt.
l.10 \showthe\oddsidemargin
?
which are exactly the same value we'd get by doing
\usepackage[left=20mm,right=20mm]{geometry}
However, xdvipdfmx
is set to output to A4 paper, according to your comments. If I open the PDF file and check its properties, I get
Creator: XeTeX output 2018.01.09:1918
Producer: xdvipdfmx (20170318)
CreationDate: Tue Jan 9 19:18:31 2018
Tagged: no
Form: none
Pages: 2
Encrypted: no
Page size: 595.28 x 841.89 pts (A4) (rotated 0 degrees)
File size: 13853 bytes
Optimized: no
PDF version: 1.5
which becomes
Creator: XeTeX output 2018.01.09:1923
Producer: xdvipdfmx (20170318)
CreationDate: Tue Jan 9 19:23:09 2018
Tagged: no
Form: none
Pages: 2
Encrypted: no
Page size: 612 x 792 pts (letter) (rotated 0 degrees)
File size: 13845 bytes
Optimized: no
PDF version: 1.5
when geometry
is loaded instead: this is because geometry
informs xdvipdfmx
of the output paper size.
In my measurement, the “non-geometry
” version has a left margin of 20mm, and the right margin becomes 14mm. What's 612 – 595.28 (Postscript points)? It's 5.9mm.
If you instead do
\documentclass[a4paper]{article}
\usepackage{fontspec}
\usepackage{lipsum}
\setlength{\textwidth}{\dimexpr \paperwidth - 20mm * 2 \relax}
\setlength{\oddsidemargin}{\dimexpr (\paperwidth - \textwidth)/2 - 1 in\relax}
\begin{document}
\lipsum
\lipsum
\end{document}
you'll get the desired margins.
\pdfpageheight
and width to\paperheight
and width)