Locating north west corner of text area
up vote
4
down vote
favorite
I would like to locate the exact position of the north west corner of the text area. Using layout
(see image in Notes section), it seems that the required offset from current page.north west
is
xshift=1.0in+hoffset+oddsidemargin,
yshift=-1.0in-voffset-headsep,
Using showframe
package: (as in MWE)
The image below is the north west corner of the text area at 6400% zoom where I have placed a gray +
and a filled in circle. This visually looks like it is pretty close to the correct location. However, to get to this position required an additional tweak of
(-0.35pt,2.35pt)%% Required shift to obtain image below (see MWE)
from the above parameters.
The somewhat related questions listed in the References section mention an issue with inner sep
and parindent
, both of which have been accounted for. (They are actually not needed here, but added them anyway).
Why is this additional tweak required?
Using showframe option to geometry
package:
IF instead of using the showframe
package, I instead use
usepackage[showframe]{geometry}
The tweak required is slightly different:
(-0.1pt,1.8pt)
which yields:
References:
TikZ: Anchor current page north west isn't where expected.
TikZ current page.north west shifted ~4pts?.
Notes:
Using
layout
, we obtain the following picture from which I obtained the parameters to compute the exact location of the north west of the text area.
Code:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+hoffset+oddsidemargin-0.35pt,
yshift=-1.0in-voffset-headsep+2.35pt,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
noindentShowNorthWestOfTextArea%
end{document}
tikz-pgf tikz-node
|
show 4 more comments
up vote
4
down vote
favorite
I would like to locate the exact position of the north west corner of the text area. Using layout
(see image in Notes section), it seems that the required offset from current page.north west
is
xshift=1.0in+hoffset+oddsidemargin,
yshift=-1.0in-voffset-headsep,
Using showframe
package: (as in MWE)
The image below is the north west corner of the text area at 6400% zoom where I have placed a gray +
and a filled in circle. This visually looks like it is pretty close to the correct location. However, to get to this position required an additional tweak of
(-0.35pt,2.35pt)%% Required shift to obtain image below (see MWE)
from the above parameters.
The somewhat related questions listed in the References section mention an issue with inner sep
and parindent
, both of which have been accounted for. (They are actually not needed here, but added them anyway).
Why is this additional tweak required?
Using showframe option to geometry
package:
IF instead of using the showframe
package, I instead use
usepackage[showframe]{geometry}
The tweak required is slightly different:
(-0.1pt,1.8pt)
which yields:
References:
TikZ: Anchor current page north west isn't where expected.
TikZ current page.north west shifted ~4pts?.
Notes:
Using
layout
, we obtain the following picture from which I obtained the parameters to compute the exact location of the north west of the text area.
Code:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+hoffset+oddsidemargin-0.35pt,
yshift=-1.0in-voffset-headsep+2.35pt,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
noindentShowNorthWestOfTextArea%
end{document}
tikz-pgf tikz-node
1
Does tikzpagenodes help? Specifically, once it is loaded you can use(current page text area.north west)
.
– Andrew
Dec 4 at 0:01
Actually, loadingtikzpagenodes
and doingtikz[overlay,remember picture]{ draw [draw=red, fill=yellow, text=gray] (current page text area.north west) circle (1pt) node [inner sep=0pt] {+};}
seems to indicate that the frame is around the text area, meaning that the line is outside and your mark is already a tiny bit outside the text area, precisely by the additional shift.
– marmot
Dec 4 at 0:06
@Andrew: Yep,tikzpagenodes
seems to do the correct position without any tweaks, so that is definitely the solution to use instead of computing it directly. I'd still be interested in what is going on though. Seems to imply some issue with eithershowframe
package (andshowframe
option togeometry
) or a deficiency with thelayout
package.
– Peter Grill
Dec 4 at 0:13
@PeterGrill I really think it is the line width. The frame is drawn in such a way that the line is completely outside the text area, but the inner boundary of the frame is the outer boundary of the text area. You place your mark in the middle of the line.
– marmot
Dec 4 at 0:16
1
@marmot: Agreed. BTW, not sure if you noticed but I updated the question: seems as if you use theshowframe
option to thegeometry
package, the line width is a more reasonable.
– Peter Grill
Dec 4 at 0:28
|
show 4 more comments
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I would like to locate the exact position of the north west corner of the text area. Using layout
(see image in Notes section), it seems that the required offset from current page.north west
is
xshift=1.0in+hoffset+oddsidemargin,
yshift=-1.0in-voffset-headsep,
Using showframe
package: (as in MWE)
The image below is the north west corner of the text area at 6400% zoom where I have placed a gray +
and a filled in circle. This visually looks like it is pretty close to the correct location. However, to get to this position required an additional tweak of
(-0.35pt,2.35pt)%% Required shift to obtain image below (see MWE)
from the above parameters.
The somewhat related questions listed in the References section mention an issue with inner sep
and parindent
, both of which have been accounted for. (They are actually not needed here, but added them anyway).
Why is this additional tweak required?
Using showframe option to geometry
package:
IF instead of using the showframe
package, I instead use
usepackage[showframe]{geometry}
The tweak required is slightly different:
(-0.1pt,1.8pt)
which yields:
References:
TikZ: Anchor current page north west isn't where expected.
TikZ current page.north west shifted ~4pts?.
Notes:
Using
layout
, we obtain the following picture from which I obtained the parameters to compute the exact location of the north west of the text area.
Code:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+hoffset+oddsidemargin-0.35pt,
yshift=-1.0in-voffset-headsep+2.35pt,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
noindentShowNorthWestOfTextArea%
end{document}
tikz-pgf tikz-node
I would like to locate the exact position of the north west corner of the text area. Using layout
(see image in Notes section), it seems that the required offset from current page.north west
is
xshift=1.0in+hoffset+oddsidemargin,
yshift=-1.0in-voffset-headsep,
Using showframe
package: (as in MWE)
The image below is the north west corner of the text area at 6400% zoom where I have placed a gray +
and a filled in circle. This visually looks like it is pretty close to the correct location. However, to get to this position required an additional tweak of
(-0.35pt,2.35pt)%% Required shift to obtain image below (see MWE)
from the above parameters.
The somewhat related questions listed in the References section mention an issue with inner sep
and parindent
, both of which have been accounted for. (They are actually not needed here, but added them anyway).
Why is this additional tweak required?
Using showframe option to geometry
package:
IF instead of using the showframe
package, I instead use
usepackage[showframe]{geometry}
The tweak required is slightly different:
(-0.1pt,1.8pt)
which yields:
References:
TikZ: Anchor current page north west isn't where expected.
TikZ current page.north west shifted ~4pts?.
Notes:
Using
layout
, we obtain the following picture from which I obtained the parameters to compute the exact location of the north west of the text area.
Code:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+hoffset+oddsidemargin-0.35pt,
yshift=-1.0in-voffset-headsep+2.35pt,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
noindentShowNorthWestOfTextArea%
end{document}
tikz-pgf tikz-node
tikz-pgf tikz-node
edited Dec 4 at 0:09
asked Dec 3 at 23:59
Peter Grill
163k24432744
163k24432744
1
Does tikzpagenodes help? Specifically, once it is loaded you can use(current page text area.north west)
.
– Andrew
Dec 4 at 0:01
Actually, loadingtikzpagenodes
and doingtikz[overlay,remember picture]{ draw [draw=red, fill=yellow, text=gray] (current page text area.north west) circle (1pt) node [inner sep=0pt] {+};}
seems to indicate that the frame is around the text area, meaning that the line is outside and your mark is already a tiny bit outside the text area, precisely by the additional shift.
– marmot
Dec 4 at 0:06
@Andrew: Yep,tikzpagenodes
seems to do the correct position without any tweaks, so that is definitely the solution to use instead of computing it directly. I'd still be interested in what is going on though. Seems to imply some issue with eithershowframe
package (andshowframe
option togeometry
) or a deficiency with thelayout
package.
– Peter Grill
Dec 4 at 0:13
@PeterGrill I really think it is the line width. The frame is drawn in such a way that the line is completely outside the text area, but the inner boundary of the frame is the outer boundary of the text area. You place your mark in the middle of the line.
– marmot
Dec 4 at 0:16
1
@marmot: Agreed. BTW, not sure if you noticed but I updated the question: seems as if you use theshowframe
option to thegeometry
package, the line width is a more reasonable.
– Peter Grill
Dec 4 at 0:28
|
show 4 more comments
1
Does tikzpagenodes help? Specifically, once it is loaded you can use(current page text area.north west)
.
– Andrew
Dec 4 at 0:01
Actually, loadingtikzpagenodes
and doingtikz[overlay,remember picture]{ draw [draw=red, fill=yellow, text=gray] (current page text area.north west) circle (1pt) node [inner sep=0pt] {+};}
seems to indicate that the frame is around the text area, meaning that the line is outside and your mark is already a tiny bit outside the text area, precisely by the additional shift.
– marmot
Dec 4 at 0:06
@Andrew: Yep,tikzpagenodes
seems to do the correct position without any tweaks, so that is definitely the solution to use instead of computing it directly. I'd still be interested in what is going on though. Seems to imply some issue with eithershowframe
package (andshowframe
option togeometry
) or a deficiency with thelayout
package.
– Peter Grill
Dec 4 at 0:13
@PeterGrill I really think it is the line width. The frame is drawn in such a way that the line is completely outside the text area, but the inner boundary of the frame is the outer boundary of the text area. You place your mark in the middle of the line.
– marmot
Dec 4 at 0:16
1
@marmot: Agreed. BTW, not sure if you noticed but I updated the question: seems as if you use theshowframe
option to thegeometry
package, the line width is a more reasonable.
– Peter Grill
Dec 4 at 0:28
1
1
Does tikzpagenodes help? Specifically, once it is loaded you can use
(current page text area.north west)
.– Andrew
Dec 4 at 0:01
Does tikzpagenodes help? Specifically, once it is loaded you can use
(current page text area.north west)
.– Andrew
Dec 4 at 0:01
Actually, loading
tikzpagenodes
and doing tikz[overlay,remember picture]{ draw [draw=red, fill=yellow, text=gray] (current page text area.north west) circle (1pt) node [inner sep=0pt] {+};}
seems to indicate that the frame is around the text area, meaning that the line is outside and your mark is already a tiny bit outside the text area, precisely by the additional shift.– marmot
Dec 4 at 0:06
Actually, loading
tikzpagenodes
and doing tikz[overlay,remember picture]{ draw [draw=red, fill=yellow, text=gray] (current page text area.north west) circle (1pt) node [inner sep=0pt] {+};}
seems to indicate that the frame is around the text area, meaning that the line is outside and your mark is already a tiny bit outside the text area, precisely by the additional shift.– marmot
Dec 4 at 0:06
@Andrew: Yep,
tikzpagenodes
seems to do the correct position without any tweaks, so that is definitely the solution to use instead of computing it directly. I'd still be interested in what is going on though. Seems to imply some issue with either showframe
package (and showframe
option to geometry
) or a deficiency with the layout
package.– Peter Grill
Dec 4 at 0:13
@Andrew: Yep,
tikzpagenodes
seems to do the correct position without any tweaks, so that is definitely the solution to use instead of computing it directly. I'd still be interested in what is going on though. Seems to imply some issue with either showframe
package (and showframe
option to geometry
) or a deficiency with the layout
package.– Peter Grill
Dec 4 at 0:13
@PeterGrill I really think it is the line width. The frame is drawn in such a way that the line is completely outside the text area, but the inner boundary of the frame is the outer boundary of the text area. You place your mark in the middle of the line.
– marmot
Dec 4 at 0:16
@PeterGrill I really think it is the line width. The frame is drawn in such a way that the line is completely outside the text area, but the inner boundary of the frame is the outer boundary of the text area. You place your mark in the middle of the line.
– marmot
Dec 4 at 0:16
1
1
@marmot: Agreed. BTW, not sure if you noticed but I updated the question: seems as if you use the
showframe
option to the geometry
package, the line width is a more reasonable.– Peter Grill
Dec 4 at 0:28
@marmot: Agreed. BTW, not sure if you noticed but I updated the question: seems as if you use the
showframe
option to the geometry
package, the line width is a more reasonable.– Peter Grill
Dec 4 at 0:28
|
show 4 more comments
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
Position of the text area relative to the page corner
The top of the layout
image generally looks like the image below, but in your case the dashed line appears to coincide with the bottom of the header because ④ (topmargin
= -13pt) and ⑤ (headheight
= 12pt) nearly cancel out.
You can read off that the horizontal/vertical distance between the top left corner of the text with respect to the top left corner of the page are
horizontal distance =
1in+hoffset+oddsidemargin
or1in+hoffset+evensidemargin
,
vertical distance =1in+voffset+topmargin+headheight+headsep
(oddsidemargin
is for single-sided documents and odd pages of double-sided documents, and evensidemargin
for even pages of double-sided documents.)
Position of the text area relative to current page.north west
For TikZ, the coordinates of the top left corner of the text area are (w.r.t. current page.north west
)
(1in+oddsidemargin, -1in-2voffset-topmargin-headheight-headsep)
for a single-sided document and odd pages of double-sided documents (and the same with evensidemargin
for even pages of a double-sided document).
Note: I have no clue why you would need to add
-2voffset
to the y coordinate, but it seems like a bug.
Perhaps a sign error was made somewhere in the code when correcting forvoffset
?
Usually
hoffset
andvoffset
are both equal to zero, however, so this won't matter.
Here is a version of your MWE with the right parameters:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+oddsidemargin,
yshift=-1.0in-2voffset-topmargin-headheight-headsep,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}
noindentShowNorthWestOfTextArea%
end{document}
Note that showframe
draws a border around the text area.
Any idea whylayout
withusepackage{layout}
in your MWE does not produce the layout image you show?
– Peter Grill
Dec 4 at 18:26
The appearance oflayout
depends on the lengths it is illustrating. The horizontal dashed line appears below the top of the header because thegeometry
package setstopmargin
to a negative value. The word "should" was probably not appropriate in the first paragraph.
– Circumscribe
Dec 4 at 18:35
Oh that makes sense. I guess thelayout
package should check to see ifgeometry
is loaded and adult the drawing appropriately -- Or at least check if the parameters are set such that it is difficult to draw a useful layout.
– Peter Grill
Dec 4 at 18:43
add a comment |
up vote
2
down vote
The package tikzpagenodes provides a useful set of tikz coordinates for:
- current page text area
- current page marginpar area
- current page header area
- current page footer area
So, if tikzpagenodes is loaded then you can get the "north west corner of the text area" using
(current page text area.north west)
from inside a tikzpicture
environment. You will need to use remember picture,overlay
for this to work.
Adapting the MWE from the question, we can use:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{tikzpagenodes}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at (current page text area.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
ShowNorthWestOfTextArea%
end{document}
With this code, the north west corner of the text area looks like:
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
Position of the text area relative to the page corner
The top of the layout
image generally looks like the image below, but in your case the dashed line appears to coincide with the bottom of the header because ④ (topmargin
= -13pt) and ⑤ (headheight
= 12pt) nearly cancel out.
You can read off that the horizontal/vertical distance between the top left corner of the text with respect to the top left corner of the page are
horizontal distance =
1in+hoffset+oddsidemargin
or1in+hoffset+evensidemargin
,
vertical distance =1in+voffset+topmargin+headheight+headsep
(oddsidemargin
is for single-sided documents and odd pages of double-sided documents, and evensidemargin
for even pages of double-sided documents.)
Position of the text area relative to current page.north west
For TikZ, the coordinates of the top left corner of the text area are (w.r.t. current page.north west
)
(1in+oddsidemargin, -1in-2voffset-topmargin-headheight-headsep)
for a single-sided document and odd pages of double-sided documents (and the same with evensidemargin
for even pages of a double-sided document).
Note: I have no clue why you would need to add
-2voffset
to the y coordinate, but it seems like a bug.
Perhaps a sign error was made somewhere in the code when correcting forvoffset
?
Usually
hoffset
andvoffset
are both equal to zero, however, so this won't matter.
Here is a version of your MWE with the right parameters:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+oddsidemargin,
yshift=-1.0in-2voffset-topmargin-headheight-headsep,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}
noindentShowNorthWestOfTextArea%
end{document}
Note that showframe
draws a border around the text area.
Any idea whylayout
withusepackage{layout}
in your MWE does not produce the layout image you show?
– Peter Grill
Dec 4 at 18:26
The appearance oflayout
depends on the lengths it is illustrating. The horizontal dashed line appears below the top of the header because thegeometry
package setstopmargin
to a negative value. The word "should" was probably not appropriate in the first paragraph.
– Circumscribe
Dec 4 at 18:35
Oh that makes sense. I guess thelayout
package should check to see ifgeometry
is loaded and adult the drawing appropriately -- Or at least check if the parameters are set such that it is difficult to draw a useful layout.
– Peter Grill
Dec 4 at 18:43
add a comment |
up vote
4
down vote
accepted
Position of the text area relative to the page corner
The top of the layout
image generally looks like the image below, but in your case the dashed line appears to coincide with the bottom of the header because ④ (topmargin
= -13pt) and ⑤ (headheight
= 12pt) nearly cancel out.
You can read off that the horizontal/vertical distance between the top left corner of the text with respect to the top left corner of the page are
horizontal distance =
1in+hoffset+oddsidemargin
or1in+hoffset+evensidemargin
,
vertical distance =1in+voffset+topmargin+headheight+headsep
(oddsidemargin
is for single-sided documents and odd pages of double-sided documents, and evensidemargin
for even pages of double-sided documents.)
Position of the text area relative to current page.north west
For TikZ, the coordinates of the top left corner of the text area are (w.r.t. current page.north west
)
(1in+oddsidemargin, -1in-2voffset-topmargin-headheight-headsep)
for a single-sided document and odd pages of double-sided documents (and the same with evensidemargin
for even pages of a double-sided document).
Note: I have no clue why you would need to add
-2voffset
to the y coordinate, but it seems like a bug.
Perhaps a sign error was made somewhere in the code when correcting forvoffset
?
Usually
hoffset
andvoffset
are both equal to zero, however, so this won't matter.
Here is a version of your MWE with the right parameters:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+oddsidemargin,
yshift=-1.0in-2voffset-topmargin-headheight-headsep,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}
noindentShowNorthWestOfTextArea%
end{document}
Note that showframe
draws a border around the text area.
Any idea whylayout
withusepackage{layout}
in your MWE does not produce the layout image you show?
– Peter Grill
Dec 4 at 18:26
The appearance oflayout
depends on the lengths it is illustrating. The horizontal dashed line appears below the top of the header because thegeometry
package setstopmargin
to a negative value. The word "should" was probably not appropriate in the first paragraph.
– Circumscribe
Dec 4 at 18:35
Oh that makes sense. I guess thelayout
package should check to see ifgeometry
is loaded and adult the drawing appropriately -- Or at least check if the parameters are set such that it is difficult to draw a useful layout.
– Peter Grill
Dec 4 at 18:43
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Position of the text area relative to the page corner
The top of the layout
image generally looks like the image below, but in your case the dashed line appears to coincide with the bottom of the header because ④ (topmargin
= -13pt) and ⑤ (headheight
= 12pt) nearly cancel out.
You can read off that the horizontal/vertical distance between the top left corner of the text with respect to the top left corner of the page are
horizontal distance =
1in+hoffset+oddsidemargin
or1in+hoffset+evensidemargin
,
vertical distance =1in+voffset+topmargin+headheight+headsep
(oddsidemargin
is for single-sided documents and odd pages of double-sided documents, and evensidemargin
for even pages of double-sided documents.)
Position of the text area relative to current page.north west
For TikZ, the coordinates of the top left corner of the text area are (w.r.t. current page.north west
)
(1in+oddsidemargin, -1in-2voffset-topmargin-headheight-headsep)
for a single-sided document and odd pages of double-sided documents (and the same with evensidemargin
for even pages of a double-sided document).
Note: I have no clue why you would need to add
-2voffset
to the y coordinate, but it seems like a bug.
Perhaps a sign error was made somewhere in the code when correcting forvoffset
?
Usually
hoffset
andvoffset
are both equal to zero, however, so this won't matter.
Here is a version of your MWE with the right parameters:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+oddsidemargin,
yshift=-1.0in-2voffset-topmargin-headheight-headsep,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}
noindentShowNorthWestOfTextArea%
end{document}
Note that showframe
draws a border around the text area.
Position of the text area relative to the page corner
The top of the layout
image generally looks like the image below, but in your case the dashed line appears to coincide with the bottom of the header because ④ (topmargin
= -13pt) and ⑤ (headheight
= 12pt) nearly cancel out.
You can read off that the horizontal/vertical distance between the top left corner of the text with respect to the top left corner of the page are
horizontal distance =
1in+hoffset+oddsidemargin
or1in+hoffset+evensidemargin
,
vertical distance =1in+voffset+topmargin+headheight+headsep
(oddsidemargin
is for single-sided documents and odd pages of double-sided documents, and evensidemargin
for even pages of double-sided documents.)
Position of the text area relative to current page.north west
For TikZ, the coordinates of the top left corner of the text area are (w.r.t. current page.north west
)
(1in+oddsidemargin, -1in-2voffset-topmargin-headheight-headsep)
for a single-sided document and odd pages of double-sided documents (and the same with evensidemargin
for even pages of a double-sided document).
Note: I have no clue why you would need to add
-2voffset
to the y coordinate, but it seems like a bug.
Perhaps a sign error was made somewhere in the code when correcting forvoffset
?
Usually
hoffset
andvoffset
are both equal to zero, however, so this won't matter.
Here is a version of your MWE with the right parameters:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+oddsidemargin,
yshift=-1.0in-2voffset-topmargin-headheight-headsep,
]current page.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}
noindentShowNorthWestOfTextArea%
end{document}
Note that showframe
draws a border around the text area.
edited Dec 4 at 19:23
answered Dec 4 at 12:12
Circumscribe
3,8371429
3,8371429
Any idea whylayout
withusepackage{layout}
in your MWE does not produce the layout image you show?
– Peter Grill
Dec 4 at 18:26
The appearance oflayout
depends on the lengths it is illustrating. The horizontal dashed line appears below the top of the header because thegeometry
package setstopmargin
to a negative value. The word "should" was probably not appropriate in the first paragraph.
– Circumscribe
Dec 4 at 18:35
Oh that makes sense. I guess thelayout
package should check to see ifgeometry
is loaded and adult the drawing appropriately -- Or at least check if the parameters are set such that it is difficult to draw a useful layout.
– Peter Grill
Dec 4 at 18:43
add a comment |
Any idea whylayout
withusepackage{layout}
in your MWE does not produce the layout image you show?
– Peter Grill
Dec 4 at 18:26
The appearance oflayout
depends on the lengths it is illustrating. The horizontal dashed line appears below the top of the header because thegeometry
package setstopmargin
to a negative value. The word "should" was probably not appropriate in the first paragraph.
– Circumscribe
Dec 4 at 18:35
Oh that makes sense. I guess thelayout
package should check to see ifgeometry
is loaded and adult the drawing appropriately -- Or at least check if the parameters are set such that it is difficult to draw a useful layout.
– Peter Grill
Dec 4 at 18:43
Any idea why
layout
with usepackage{layout}
in your MWE does not produce the layout image you show?– Peter Grill
Dec 4 at 18:26
Any idea why
layout
with usepackage{layout}
in your MWE does not produce the layout image you show?– Peter Grill
Dec 4 at 18:26
The appearance of
layout
depends on the lengths it is illustrating. The horizontal dashed line appears below the top of the header because the geometry
package sets topmargin
to a negative value. The word "should" was probably not appropriate in the first paragraph.– Circumscribe
Dec 4 at 18:35
The appearance of
layout
depends on the lengths it is illustrating. The horizontal dashed line appears below the top of the header because the geometry
package sets topmargin
to a negative value. The word "should" was probably not appropriate in the first paragraph.– Circumscribe
Dec 4 at 18:35
Oh that makes sense. I guess the
layout
package should check to see if geometry
is loaded and adult the drawing appropriately -- Or at least check if the parameters are set such that it is difficult to draw a useful layout.– Peter Grill
Dec 4 at 18:43
Oh that makes sense. I guess the
layout
package should check to see if geometry
is loaded and adult the drawing appropriately -- Or at least check if the parameters are set such that it is difficult to draw a useful layout.– Peter Grill
Dec 4 at 18:43
add a comment |
up vote
2
down vote
The package tikzpagenodes provides a useful set of tikz coordinates for:
- current page text area
- current page marginpar area
- current page header area
- current page footer area
So, if tikzpagenodes is loaded then you can get the "north west corner of the text area" using
(current page text area.north west)
from inside a tikzpicture
environment. You will need to use remember picture,overlay
for this to work.
Adapting the MWE from the question, we can use:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{tikzpagenodes}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at (current page text area.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
ShowNorthWestOfTextArea%
end{document}
With this code, the north west corner of the text area looks like:
add a comment |
up vote
2
down vote
The package tikzpagenodes provides a useful set of tikz coordinates for:
- current page text area
- current page marginpar area
- current page header area
- current page footer area
So, if tikzpagenodes is loaded then you can get the "north west corner of the text area" using
(current page text area.north west)
from inside a tikzpicture
environment. You will need to use remember picture,overlay
for this to work.
Adapting the MWE from the question, we can use:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{tikzpagenodes}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at (current page text area.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
ShowNorthWestOfTextArea%
end{document}
With this code, the north west corner of the text area looks like:
add a comment |
up vote
2
down vote
up vote
2
down vote
The package tikzpagenodes provides a useful set of tikz coordinates for:
- current page text area
- current page marginpar area
- current page header area
- current page footer area
So, if tikzpagenodes is loaded then you can get the "north west corner of the text area" using
(current page text area.north west)
from inside a tikzpicture
environment. You will need to use remember picture,overlay
for this to work.
Adapting the MWE from the question, we can use:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{tikzpagenodes}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at (current page text area.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
ShowNorthWestOfTextArea%
end{document}
With this code, the north west corner of the text area looks like:
The package tikzpagenodes provides a useful set of tikz coordinates for:
- current page text area
- current page marginpar area
- current page header area
- current page footer area
So, if tikzpagenodes is loaded then you can get the "north west corner of the text area" using
(current page text area.north west)
from inside a tikzpicture
environment. You will need to use remember picture,overlay
for this to work.
Adapting the MWE from the question, we can use:
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage{tikzpagenodes}
usepackage{layout}
usepackage{geometry}
newcommand*{ShowNorthWestOfTextArea}{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at (current page text area.north west);
draw [draw=red, fill=yellow, text=gray] (X) circle (1pt)
node [inner sep=0pt] {+};
end{tikzpicture}%
}%
begin{document}%layout% <-- uncomment to obtain the layout parameters
ShowNorthWestOfTextArea%
end{document}
With this code, the north west corner of the text area looks like:
answered Dec 5 at 4:44
Andrew
30.3k34380
30.3k34380
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463069%2flocating-north-west-corner-of-text-area%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Does tikzpagenodes help? Specifically, once it is loaded you can use
(current page text area.north west)
.– Andrew
Dec 4 at 0:01
Actually, loading
tikzpagenodes
and doingtikz[overlay,remember picture]{ draw [draw=red, fill=yellow, text=gray] (current page text area.north west) circle (1pt) node [inner sep=0pt] {+};}
seems to indicate that the frame is around the text area, meaning that the line is outside and your mark is already a tiny bit outside the text area, precisely by the additional shift.– marmot
Dec 4 at 0:06
@Andrew: Yep,
tikzpagenodes
seems to do the correct position without any tweaks, so that is definitely the solution to use instead of computing it directly. I'd still be interested in what is going on though. Seems to imply some issue with eithershowframe
package (andshowframe
option togeometry
) or a deficiency with thelayout
package.– Peter Grill
Dec 4 at 0:13
@PeterGrill I really think it is the line width. The frame is drawn in such a way that the line is completely outside the text area, but the inner boundary of the frame is the outer boundary of the text area. You place your mark in the middle of the line.
– marmot
Dec 4 at 0:16
1
@marmot: Agreed. BTW, not sure if you noticed but I updated the question: seems as if you use the
showframe
option to thegeometry
package, the line width is a more reasonable.– Peter Grill
Dec 4 at 0:28