Locating north west corner of text area











up vote
4
down vote

favorite
1












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?



enter image description here



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:



enter image description here



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.



    enter image description here



    enter image description here




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}









share|improve this question




















  • 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 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












  • @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 the geometry package, the line width is a more reasonable.
    – Peter Grill
    Dec 4 at 0:28

















up vote
4
down vote

favorite
1












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?



enter image description here



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:



enter image description here



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.



    enter image description here



    enter image description here




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}









share|improve this question




















  • 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 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












  • @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 the geometry package, the line width is a more reasonable.
    – Peter Grill
    Dec 4 at 0:28















up vote
4
down vote

favorite
1









up vote
4
down vote

favorite
1






1





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?



enter image description here



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:



enter image description here



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.



    enter image description here



    enter image description here




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}









share|improve this question















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?



enter image description here



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:



enter image description here



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.



    enter image description here



    enter image description here




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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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, 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












  • @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 the geometry package, the line width is a more reasonable.
    – Peter Grill
    Dec 4 at 0:28
















  • 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 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












  • @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 the geometry 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












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.



distances



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 or 1in+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 for voffset?



Usually hoffset and voffset 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}


output



Note that showframe draws a border around the text area.






share|improve this answer























  • 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










  • 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


















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:



enter image description here






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    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

























    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.



    distances



    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 or 1in+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 for voffset?



    Usually hoffset and voffset 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}


    output



    Note that showframe draws a border around the text area.






    share|improve this answer























    • 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










    • 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















    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.



    distances



    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 or 1in+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 for voffset?



    Usually hoffset and voffset 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}


    output



    Note that showframe draws a border around the text area.






    share|improve this answer























    • 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










    • 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













    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.



    distances



    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 or 1in+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 for voffset?



    Usually hoffset and voffset 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}


    output



    Note that showframe draws a border around the text area.






    share|improve this answer














    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.



    distances



    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 or 1in+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 for voffset?



    Usually hoffset and voffset 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}


    output



    Note that showframe draws a border around the text area.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 4 at 19:23

























    answered Dec 4 at 12:12









    Circumscribe

    3,8371429




    3,8371429












    • 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










    • 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


















    • 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










    • 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
















    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










    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:



    enter image description here






    share|improve this answer

























      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:



      enter image description here






      share|improve this answer























        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:



        enter image description here






        share|improve this answer












        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:



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 5 at 4:44









        Andrew

        30.3k34380




        30.3k34380






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?