tcolorbox not centering in absolute positioning tikz node












1















Alright people, I've stumped myself again. It appears (to me at least) that tcolorbox has some outside margins or padding that I don't know how to control.



I use tikz absolute positioning to format the elements of my letters that I need in specific space. For example, this below payment slip need to stay inside the top third of this page (represented by the red filling) because this will be printed on a perforated page.



north east 0,0 offset



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage{lastpage}
usepackage{textcomp}
usepackage{eurosym}
usepackage{setspace}
usepackage{helvet}
usepackage{times}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{multirow}
usepackage{longtable}
usepackage{array}
usepackage[table]{xcolor}
usepackage{graphicx}
usepackage{tcolorbox}
usepackage{tikz}
usetikzlibrary{shapes,positioning}
usepackage{qrcode}
usepackage{pst-barcode}
graphicspath{{/usr/local/lariat/.template/lib/img/logo/}}




pgfdeclarelayer{back}
pgfdeclarelayer{front}
pgfsetlayers{back,main,front}

begin{document}

fontencoding{T1}
fontfamily{phv}
fontsize{10}{12}
selectfont



begin{tikzpicture}[remember picture,overlay]

begin{pgfonlayer}{front}




node [xshift=-0pt,yshift=0pt, fill=red, minimum height=264pt, minimum width=614pt,anchor=north east] at (current page.north east) {};

node [xshift=-0pt,yshift=-5pt, anchor=north east] at (current page.north east) {
begin{tcolorbox}[width=582pt, colframe=darkgray, colback=darkgray, left=-3pt, top=-5pt, coltitle=white, boxsep=2mm, boxcolor=red,boxrule=.1mm, arc=1.5mm, title=centering textbf{Payment Authorization}]
includegraphics[width=575pt]{paymentform.pdf}
end{tcolorbox}
};


end{pgfonlayer}
end{tikzpicture}


end{document}


Additionally, I've noticed that my letter paper is actually 614pt instead of 612pt wide, does anyone know why that is?



Thanks in advance for your assistance you beautiful Latex people.










share|improve this question


















  • 1





    I can not compile your code. It is missing some pdf.

    – Sigur
    Feb 16 at 18:10













  • If you use showframe option in geometry you can have a better idea how the page contents are positioned.

    – Sigur
    Feb 16 at 18:15











  • Also, maybe you wish lmargin=0pt,rmargin=0pt,paperwidth=614pt.

    – Sigur
    Feb 16 at 18:18











  • Here is where my confusion comes in, my tcolorbox is in a tikz node that is absolute positioned to the page.north east. It isn't (or shouldn't be) affected by the page margins. The red node behind my tcolorbox does position to the north east exactly. It's just the tcolorbox that seems to have some kind of padding around it.

    – James Dunlap
    Feb 16 at 18:30






  • 2





    TikZ nodes have some inner sep which makes that the inner tcolorbox is not adjusted with node's corner. By the way, if you only use tcolorbox to include an image, why not use a tikz node?

    – Ignasi
    Feb 16 at 18:42
















1















Alright people, I've stumped myself again. It appears (to me at least) that tcolorbox has some outside margins or padding that I don't know how to control.



I use tikz absolute positioning to format the elements of my letters that I need in specific space. For example, this below payment slip need to stay inside the top third of this page (represented by the red filling) because this will be printed on a perforated page.



north east 0,0 offset



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage{lastpage}
usepackage{textcomp}
usepackage{eurosym}
usepackage{setspace}
usepackage{helvet}
usepackage{times}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{multirow}
usepackage{longtable}
usepackage{array}
usepackage[table]{xcolor}
usepackage{graphicx}
usepackage{tcolorbox}
usepackage{tikz}
usetikzlibrary{shapes,positioning}
usepackage{qrcode}
usepackage{pst-barcode}
graphicspath{{/usr/local/lariat/.template/lib/img/logo/}}




pgfdeclarelayer{back}
pgfdeclarelayer{front}
pgfsetlayers{back,main,front}

begin{document}

fontencoding{T1}
fontfamily{phv}
fontsize{10}{12}
selectfont



begin{tikzpicture}[remember picture,overlay]

begin{pgfonlayer}{front}




node [xshift=-0pt,yshift=0pt, fill=red, minimum height=264pt, minimum width=614pt,anchor=north east] at (current page.north east) {};

node [xshift=-0pt,yshift=-5pt, anchor=north east] at (current page.north east) {
begin{tcolorbox}[width=582pt, colframe=darkgray, colback=darkgray, left=-3pt, top=-5pt, coltitle=white, boxsep=2mm, boxcolor=red,boxrule=.1mm, arc=1.5mm, title=centering textbf{Payment Authorization}]
includegraphics[width=575pt]{paymentform.pdf}
end{tcolorbox}
};


end{pgfonlayer}
end{tikzpicture}


end{document}


Additionally, I've noticed that my letter paper is actually 614pt instead of 612pt wide, does anyone know why that is?



Thanks in advance for your assistance you beautiful Latex people.










share|improve this question


















  • 1





    I can not compile your code. It is missing some pdf.

    – Sigur
    Feb 16 at 18:10













  • If you use showframe option in geometry you can have a better idea how the page contents are positioned.

    – Sigur
    Feb 16 at 18:15











  • Also, maybe you wish lmargin=0pt,rmargin=0pt,paperwidth=614pt.

    – Sigur
    Feb 16 at 18:18











  • Here is where my confusion comes in, my tcolorbox is in a tikz node that is absolute positioned to the page.north east. It isn't (or shouldn't be) affected by the page margins. The red node behind my tcolorbox does position to the north east exactly. It's just the tcolorbox that seems to have some kind of padding around it.

    – James Dunlap
    Feb 16 at 18:30






  • 2





    TikZ nodes have some inner sep which makes that the inner tcolorbox is not adjusted with node's corner. By the way, if you only use tcolorbox to include an image, why not use a tikz node?

    – Ignasi
    Feb 16 at 18:42














1












1








1


0






Alright people, I've stumped myself again. It appears (to me at least) that tcolorbox has some outside margins or padding that I don't know how to control.



I use tikz absolute positioning to format the elements of my letters that I need in specific space. For example, this below payment slip need to stay inside the top third of this page (represented by the red filling) because this will be printed on a perforated page.



north east 0,0 offset



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage{lastpage}
usepackage{textcomp}
usepackage{eurosym}
usepackage{setspace}
usepackage{helvet}
usepackage{times}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{multirow}
usepackage{longtable}
usepackage{array}
usepackage[table]{xcolor}
usepackage{graphicx}
usepackage{tcolorbox}
usepackage{tikz}
usetikzlibrary{shapes,positioning}
usepackage{qrcode}
usepackage{pst-barcode}
graphicspath{{/usr/local/lariat/.template/lib/img/logo/}}




pgfdeclarelayer{back}
pgfdeclarelayer{front}
pgfsetlayers{back,main,front}

begin{document}

fontencoding{T1}
fontfamily{phv}
fontsize{10}{12}
selectfont



begin{tikzpicture}[remember picture,overlay]

begin{pgfonlayer}{front}




node [xshift=-0pt,yshift=0pt, fill=red, minimum height=264pt, minimum width=614pt,anchor=north east] at (current page.north east) {};

node [xshift=-0pt,yshift=-5pt, anchor=north east] at (current page.north east) {
begin{tcolorbox}[width=582pt, colframe=darkgray, colback=darkgray, left=-3pt, top=-5pt, coltitle=white, boxsep=2mm, boxcolor=red,boxrule=.1mm, arc=1.5mm, title=centering textbf{Payment Authorization}]
includegraphics[width=575pt]{paymentform.pdf}
end{tcolorbox}
};


end{pgfonlayer}
end{tikzpicture}


end{document}


Additionally, I've noticed that my letter paper is actually 614pt instead of 612pt wide, does anyone know why that is?



Thanks in advance for your assistance you beautiful Latex people.










share|improve this question














Alright people, I've stumped myself again. It appears (to me at least) that tcolorbox has some outside margins or padding that I don't know how to control.



I use tikz absolute positioning to format the elements of my letters that I need in specific space. For example, this below payment slip need to stay inside the top third of this page (represented by the red filling) because this will be printed on a perforated page.



north east 0,0 offset



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage{lastpage}
usepackage{textcomp}
usepackage{eurosym}
usepackage{setspace}
usepackage{helvet}
usepackage{times}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{multirow}
usepackage{longtable}
usepackage{array}
usepackage[table]{xcolor}
usepackage{graphicx}
usepackage{tcolorbox}
usepackage{tikz}
usetikzlibrary{shapes,positioning}
usepackage{qrcode}
usepackage{pst-barcode}
graphicspath{{/usr/local/lariat/.template/lib/img/logo/}}




pgfdeclarelayer{back}
pgfdeclarelayer{front}
pgfsetlayers{back,main,front}

begin{document}

fontencoding{T1}
fontfamily{phv}
fontsize{10}{12}
selectfont



begin{tikzpicture}[remember picture,overlay]

begin{pgfonlayer}{front}




node [xshift=-0pt,yshift=0pt, fill=red, minimum height=264pt, minimum width=614pt,anchor=north east] at (current page.north east) {};

node [xshift=-0pt,yshift=-5pt, anchor=north east] at (current page.north east) {
begin{tcolorbox}[width=582pt, colframe=darkgray, colback=darkgray, left=-3pt, top=-5pt, coltitle=white, boxsep=2mm, boxcolor=red,boxrule=.1mm, arc=1.5mm, title=centering textbf{Payment Authorization}]
includegraphics[width=575pt]{paymentform.pdf}
end{tcolorbox}
};


end{pgfonlayer}
end{tikzpicture}


end{document}


Additionally, I've noticed that my letter paper is actually 614pt instead of 612pt wide, does anyone know why that is?



Thanks in advance for your assistance you beautiful Latex people.







tikz-pgf margins tcolorbox tikz-node






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 16 at 18:07









James DunlapJames Dunlap

273




273








  • 1





    I can not compile your code. It is missing some pdf.

    – Sigur
    Feb 16 at 18:10













  • If you use showframe option in geometry you can have a better idea how the page contents are positioned.

    – Sigur
    Feb 16 at 18:15











  • Also, maybe you wish lmargin=0pt,rmargin=0pt,paperwidth=614pt.

    – Sigur
    Feb 16 at 18:18











  • Here is where my confusion comes in, my tcolorbox is in a tikz node that is absolute positioned to the page.north east. It isn't (or shouldn't be) affected by the page margins. The red node behind my tcolorbox does position to the north east exactly. It's just the tcolorbox that seems to have some kind of padding around it.

    – James Dunlap
    Feb 16 at 18:30






  • 2





    TikZ nodes have some inner sep which makes that the inner tcolorbox is not adjusted with node's corner. By the way, if you only use tcolorbox to include an image, why not use a tikz node?

    – Ignasi
    Feb 16 at 18:42














  • 1





    I can not compile your code. It is missing some pdf.

    – Sigur
    Feb 16 at 18:10













  • If you use showframe option in geometry you can have a better idea how the page contents are positioned.

    – Sigur
    Feb 16 at 18:15











  • Also, maybe you wish lmargin=0pt,rmargin=0pt,paperwidth=614pt.

    – Sigur
    Feb 16 at 18:18











  • Here is where my confusion comes in, my tcolorbox is in a tikz node that is absolute positioned to the page.north east. It isn't (or shouldn't be) affected by the page margins. The red node behind my tcolorbox does position to the north east exactly. It's just the tcolorbox that seems to have some kind of padding around it.

    – James Dunlap
    Feb 16 at 18:30






  • 2





    TikZ nodes have some inner sep which makes that the inner tcolorbox is not adjusted with node's corner. By the way, if you only use tcolorbox to include an image, why not use a tikz node?

    – Ignasi
    Feb 16 at 18:42








1




1





I can not compile your code. It is missing some pdf.

– Sigur
Feb 16 at 18:10







I can not compile your code. It is missing some pdf.

– Sigur
Feb 16 at 18:10















If you use showframe option in geometry you can have a better idea how the page contents are positioned.

– Sigur
Feb 16 at 18:15





If you use showframe option in geometry you can have a better idea how the page contents are positioned.

– Sigur
Feb 16 at 18:15













Also, maybe you wish lmargin=0pt,rmargin=0pt,paperwidth=614pt.

– Sigur
Feb 16 at 18:18





Also, maybe you wish lmargin=0pt,rmargin=0pt,paperwidth=614pt.

– Sigur
Feb 16 at 18:18













Here is where my confusion comes in, my tcolorbox is in a tikz node that is absolute positioned to the page.north east. It isn't (or shouldn't be) affected by the page margins. The red node behind my tcolorbox does position to the north east exactly. It's just the tcolorbox that seems to have some kind of padding around it.

– James Dunlap
Feb 16 at 18:30





Here is where my confusion comes in, my tcolorbox is in a tikz node that is absolute positioned to the page.north east. It isn't (or shouldn't be) affected by the page margins. The red node behind my tcolorbox does position to the north east exactly. It's just the tcolorbox that seems to have some kind of padding around it.

– James Dunlap
Feb 16 at 18:30




2




2





TikZ nodes have some inner sep which makes that the inner tcolorbox is not adjusted with node's corner. By the way, if you only use tcolorbox to include an image, why not use a tikz node?

– Ignasi
Feb 16 at 18:42





TikZ nodes have some inner sep which makes that the inner tcolorbox is not adjusted with node's corner. By the way, if you only use tcolorbox to include an image, why not use a tikz node?

– Ignasi
Feb 16 at 18:42










1 Answer
1






active

oldest

votes


















2














This could be an alternative construction without tcolorbox



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{shapes,positioning}

begin{document}

begin{tikzpicture}[remember picture,overlay]
node[fill=red,
minimum height=264pt, minimum width=614pt,
below left=0pt of current page.north east] (A) {};

matrix[rounded corners, fill=darkgray,
below left=0pt of current page.north east]
{
node[anchor=center, font=sffamilybfseries, color=white]{Payment Authorization};\
node[anchor=center, inner sep=0pt]{includegraphics[width=575pt, height=200pt]{example-image-A}};\
};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • Thanks, Ignasi! I suppose I was using tcolorbox because it makes for some quick and easy formatting across my applications, especially when I'm using different color headers, borders, and body. I suppose I'll need to up by node formatting game.

    – James Dunlap
    Feb 16 at 19:51











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',
autoActivateHeartbeat: false,
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%2f475231%2ftcolorbox-not-centering-in-absolute-positioning-tikz-node%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














This could be an alternative construction without tcolorbox



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{shapes,positioning}

begin{document}

begin{tikzpicture}[remember picture,overlay]
node[fill=red,
minimum height=264pt, minimum width=614pt,
below left=0pt of current page.north east] (A) {};

matrix[rounded corners, fill=darkgray,
below left=0pt of current page.north east]
{
node[anchor=center, font=sffamilybfseries, color=white]{Payment Authorization};\
node[anchor=center, inner sep=0pt]{includegraphics[width=575pt, height=200pt]{example-image-A}};\
};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • Thanks, Ignasi! I suppose I was using tcolorbox because it makes for some quick and easy formatting across my applications, especially when I'm using different color headers, borders, and body. I suppose I'll need to up by node formatting game.

    – James Dunlap
    Feb 16 at 19:51
















2














This could be an alternative construction without tcolorbox



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{shapes,positioning}

begin{document}

begin{tikzpicture}[remember picture,overlay]
node[fill=red,
minimum height=264pt, minimum width=614pt,
below left=0pt of current page.north east] (A) {};

matrix[rounded corners, fill=darkgray,
below left=0pt of current page.north east]
{
node[anchor=center, font=sffamilybfseries, color=white]{Payment Authorization};\
node[anchor=center, inner sep=0pt]{includegraphics[width=575pt, height=200pt]{example-image-A}};\
};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • Thanks, Ignasi! I suppose I was using tcolorbox because it makes for some quick and easy formatting across my applications, especially when I'm using different color headers, borders, and body. I suppose I'll need to up by node formatting game.

    – James Dunlap
    Feb 16 at 19:51














2












2








2







This could be an alternative construction without tcolorbox



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{shapes,positioning}

begin{document}

begin{tikzpicture}[remember picture,overlay]
node[fill=red,
minimum height=264pt, minimum width=614pt,
below left=0pt of current page.north east] (A) {};

matrix[rounded corners, fill=darkgray,
below left=0pt of current page.north east]
{
node[anchor=center, font=sffamilybfseries, color=white]{Payment Authorization};\
node[anchor=center, inner sep=0pt]{includegraphics[width=575pt, height=200pt]{example-image-A}};\
};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer













This could be an alternative construction without tcolorbox



documentclass[letterpaper]{letter}
usepackage[lmargin=30pt,rmargin=30pt,tmargin=30pt,bmargin=30pt,includefoot]{geometry}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{shapes,positioning}

begin{document}

begin{tikzpicture}[remember picture,overlay]
node[fill=red,
minimum height=264pt, minimum width=614pt,
below left=0pt of current page.north east] (A) {};

matrix[rounded corners, fill=darkgray,
below left=0pt of current page.north east]
{
node[anchor=center, font=sffamilybfseries, color=white]{Payment Authorization};\
node[anchor=center, inner sep=0pt]{includegraphics[width=575pt, height=200pt]{example-image-A}};\
};
end{tikzpicture}
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 16 at 19:38









IgnasiIgnasi

93.6k4169311




93.6k4169311













  • Thanks, Ignasi! I suppose I was using tcolorbox because it makes for some quick and easy formatting across my applications, especially when I'm using different color headers, borders, and body. I suppose I'll need to up by node formatting game.

    – James Dunlap
    Feb 16 at 19:51



















  • Thanks, Ignasi! I suppose I was using tcolorbox because it makes for some quick and easy formatting across my applications, especially when I'm using different color headers, borders, and body. I suppose I'll need to up by node formatting game.

    – James Dunlap
    Feb 16 at 19:51

















Thanks, Ignasi! I suppose I was using tcolorbox because it makes for some quick and easy formatting across my applications, especially when I'm using different color headers, borders, and body. I suppose I'll need to up by node formatting game.

– James Dunlap
Feb 16 at 19:51





Thanks, Ignasi! I suppose I was using tcolorbox because it makes for some quick and easy formatting across my applications, especially when I'm using different color headers, borders, and body. I suppose I'll need to up by node formatting game.

– James Dunlap
Feb 16 at 19:51


















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475231%2ftcolorbox-not-centering-in-absolute-positioning-tikz-node%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

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?