Adjustbox margin
I want to display a vertical line in the middle of my document.
For creating the line I use tikz and for adjusting a margin I use adjustbox.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usetikzlibrary{positioning}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
usepackage{adjustbox}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
adjustbox{margin*=0cm 1cm 1cm 0cm}{
fill[black] (current page.north) rectangle ([xshift=0.1cm]current page.south);
}
end{tikzpicture}
end{document}
Unfortunately, the margin is either applied to the bottom OR to the top. But not both.
Regards Andi
tikz-pgf adjustbox
add a comment |
I want to display a vertical line in the middle of my document.
For creating the line I use tikz and for adjusting a margin I use adjustbox.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usetikzlibrary{positioning}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
usepackage{adjustbox}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
adjustbox{margin*=0cm 1cm 1cm 0cm}{
fill[black] (current page.north) rectangle ([xshift=0.1cm]current page.south);
}
end{tikzpicture}
end{document}
Unfortunately, the margin is either applied to the bottom OR to the top. But not both.
Regards Andi
tikz-pgf adjustbox
Does the margin mean that the line starts one cm below the top and ends one cm above the bottom? If so, just dodraw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
.
– marmot
May 27 at 20:33
@marmot Thank you very much! Thats exactly what I wanted.
– AndiLeni
May 27 at 20:49
Also, addingadjustbox
inside atikzpicture
does not work as indented. You need to apply it around it.
– Martin Scharrer♦
49 mins ago
@marmot: Please post your comment as an answer, so that AndiLeni can accept it to conclude the question.
– Martin Scharrer♦
48 mins ago
@MartinScharrer Done, thanks for pinging me.
– marmot
26 mins ago
add a comment |
I want to display a vertical line in the middle of my document.
For creating the line I use tikz and for adjusting a margin I use adjustbox.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usetikzlibrary{positioning}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
usepackage{adjustbox}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
adjustbox{margin*=0cm 1cm 1cm 0cm}{
fill[black] (current page.north) rectangle ([xshift=0.1cm]current page.south);
}
end{tikzpicture}
end{document}
Unfortunately, the margin is either applied to the bottom OR to the top. But not both.
Regards Andi
tikz-pgf adjustbox
I want to display a vertical line in the middle of my document.
For creating the line I use tikz and for adjusting a margin I use adjustbox.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usetikzlibrary{positioning}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
usepackage{adjustbox}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
adjustbox{margin*=0cm 1cm 1cm 0cm}{
fill[black] (current page.north) rectangle ([xshift=0.1cm]current page.south);
}
end{tikzpicture}
end{document}
Unfortunately, the margin is either applied to the bottom OR to the top. But not both.
Regards Andi
tikz-pgf adjustbox
tikz-pgf adjustbox
edited May 27 at 18:49
asked May 27 at 18:30
AndiLeni
403
403
Does the margin mean that the line starts one cm below the top and ends one cm above the bottom? If so, just dodraw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
.
– marmot
May 27 at 20:33
@marmot Thank you very much! Thats exactly what I wanted.
– AndiLeni
May 27 at 20:49
Also, addingadjustbox
inside atikzpicture
does not work as indented. You need to apply it around it.
– Martin Scharrer♦
49 mins ago
@marmot: Please post your comment as an answer, so that AndiLeni can accept it to conclude the question.
– Martin Scharrer♦
48 mins ago
@MartinScharrer Done, thanks for pinging me.
– marmot
26 mins ago
add a comment |
Does the margin mean that the line starts one cm below the top and ends one cm above the bottom? If so, just dodraw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
.
– marmot
May 27 at 20:33
@marmot Thank you very much! Thats exactly what I wanted.
– AndiLeni
May 27 at 20:49
Also, addingadjustbox
inside atikzpicture
does not work as indented. You need to apply it around it.
– Martin Scharrer♦
49 mins ago
@marmot: Please post your comment as an answer, so that AndiLeni can accept it to conclude the question.
– Martin Scharrer♦
48 mins ago
@MartinScharrer Done, thanks for pinging me.
– marmot
26 mins ago
Does the margin mean that the line starts one cm below the top and ends one cm above the bottom? If so, just do
draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
.– marmot
May 27 at 20:33
Does the margin mean that the line starts one cm below the top and ends one cm above the bottom? If so, just do
draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
.– marmot
May 27 at 20:33
@marmot Thank you very much! Thats exactly what I wanted.
– AndiLeni
May 27 at 20:49
@marmot Thank you very much! Thats exactly what I wanted.
– AndiLeni
May 27 at 20:49
Also, adding
adjustbox
inside a tikzpicture
does not work as indented. You need to apply it around it.– Martin Scharrer♦
49 mins ago
Also, adding
adjustbox
inside a tikzpicture
does not work as indented. You need to apply it around it.– Martin Scharrer♦
49 mins ago
@marmot: Please post your comment as an answer, so that AndiLeni can accept it to conclude the question.
– Martin Scharrer♦
48 mins ago
@marmot: Please post your comment as an answer, so that AndiLeni can accept it to conclude the question.
– Martin Scharrer♦
48 mins ago
@MartinScharrer Done, thanks for pinging me.
– marmot
26 mins ago
@MartinScharrer Done, thanks for pinging me.
– marmot
26 mins ago
add a comment |
2 Answers
2
active
oldest
votes
I think this task is easier with eso-pic
:
documentclass[a4paper,12pt]{article}
usepackage{eso-pic}
AddToShipoutPicture{
thicklines
setlengthunitlength{1mm}
AtPageCenter{line(0,1){138.5}}
AtPageCenter{line(0,-1){138.5}}
}
pagestyle{empty}
begin{document}
null
end{document}
Note: magic number 138.5mm is half of A4 paper height (297mm) minus 1cm for top and bottom margins.
add a comment |
From my above comment.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
end{tikzpicture}
end{document}
Please add the comment text into your answer (maybe modified a little), so that the answer is selfcontaining.
– Martin Scharrer♦
21 mins ago
add a comment |
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
});
}
});
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%2f433670%2fadjustbox-margin%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
I think this task is easier with eso-pic
:
documentclass[a4paper,12pt]{article}
usepackage{eso-pic}
AddToShipoutPicture{
thicklines
setlengthunitlength{1mm}
AtPageCenter{line(0,1){138.5}}
AtPageCenter{line(0,-1){138.5}}
}
pagestyle{empty}
begin{document}
null
end{document}
Note: magic number 138.5mm is half of A4 paper height (297mm) minus 1cm for top and bottom margins.
add a comment |
I think this task is easier with eso-pic
:
documentclass[a4paper,12pt]{article}
usepackage{eso-pic}
AddToShipoutPicture{
thicklines
setlengthunitlength{1mm}
AtPageCenter{line(0,1){138.5}}
AtPageCenter{line(0,-1){138.5}}
}
pagestyle{empty}
begin{document}
null
end{document}
Note: magic number 138.5mm is half of A4 paper height (297mm) minus 1cm for top and bottom margins.
add a comment |
I think this task is easier with eso-pic
:
documentclass[a4paper,12pt]{article}
usepackage{eso-pic}
AddToShipoutPicture{
thicklines
setlengthunitlength{1mm}
AtPageCenter{line(0,1){138.5}}
AtPageCenter{line(0,-1){138.5}}
}
pagestyle{empty}
begin{document}
null
end{document}
Note: magic number 138.5mm is half of A4 paper height (297mm) minus 1cm for top and bottom margins.
I think this task is easier with eso-pic
:
documentclass[a4paper,12pt]{article}
usepackage{eso-pic}
AddToShipoutPicture{
thicklines
setlengthunitlength{1mm}
AtPageCenter{line(0,1){138.5}}
AtPageCenter{line(0,-1){138.5}}
}
pagestyle{empty}
begin{document}
null
end{document}
Note: magic number 138.5mm is half of A4 paper height (297mm) minus 1cm for top and bottom margins.
edited May 28 at 6:08
answered May 27 at 20:50
Ignasi
91.6k4165303
91.6k4165303
add a comment |
add a comment |
From my above comment.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
end{tikzpicture}
end{document}
Please add the comment text into your answer (maybe modified a little), so that the answer is selfcontaining.
– Martin Scharrer♦
21 mins ago
add a comment |
From my above comment.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
end{tikzpicture}
end{document}
Please add the comment text into your answer (maybe modified a little), so that the answer is selfcontaining.
– Martin Scharrer♦
21 mins ago
add a comment |
From my above comment.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
end{tikzpicture}
end{document}
From my above comment.
documentclass[a4paper,12pt]{article}
usepackage{tikz}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{noto-sans}
renewcommand{familydefault}{sfdefault}
usepackage{geometry}
geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}
usepackage{showframe}
setlength{parindent}{0cm}
begin{document}
thispagestyle{empty}
begin{tikzpicture}[remember picture,overlay]
draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
end{tikzpicture}
end{document}
answered 26 mins ago
marmot
86.7k499185
86.7k499185
Please add the comment text into your answer (maybe modified a little), so that the answer is selfcontaining.
– Martin Scharrer♦
21 mins ago
add a comment |
Please add the comment text into your answer (maybe modified a little), so that the answer is selfcontaining.
– Martin Scharrer♦
21 mins ago
Please add the comment text into your answer (maybe modified a little), so that the answer is selfcontaining.
– Martin Scharrer♦
21 mins ago
Please add the comment text into your answer (maybe modified a little), so that the answer is selfcontaining.
– Martin Scharrer♦
21 mins ago
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%2f433670%2fadjustbox-margin%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
Does the margin mean that the line starts one cm below the top and ends one cm above the bottom? If so, just do
draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
.– marmot
May 27 at 20:33
@marmot Thank you very much! Thats exactly what I wanted.
– AndiLeni
May 27 at 20:49
Also, adding
adjustbox
inside atikzpicture
does not work as indented. You need to apply it around it.– Martin Scharrer♦
49 mins ago
@marmot: Please post your comment as an answer, so that AndiLeni can accept it to conclude the question.
– Martin Scharrer♦
48 mins ago
@MartinScharrer Done, thanks for pinging me.
– marmot
26 mins ago