Coloured box on top and left side of text
up vote
2
down vote
favorite
How can i create a document where each page consist of a text-box containing the page's content, with a colored box on its top and left side and the same heading (text 1) on each side, like shown in the picture below which was created in publisher?
I have already looked into coloring the marginpar with tikz, but i am unable to get the desired result.
tikz-pgf
add a comment |
up vote
2
down vote
favorite
How can i create a document where each page consist of a text-box containing the page's content, with a colored box on its top and left side and the same heading (text 1) on each side, like shown in the picture below which was created in publisher?
I have already looked into coloring the marginpar with tikz, but i am unable to get the desired result.
tikz-pgf
1
Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
– nidhin
Nov 23 at 20:32
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
How can i create a document where each page consist of a text-box containing the page's content, with a colored box on its top and left side and the same heading (text 1) on each side, like shown in the picture below which was created in publisher?
I have already looked into coloring the marginpar with tikz, but i am unable to get the desired result.
tikz-pgf
How can i create a document where each page consist of a text-box containing the page's content, with a colored box on its top and left side and the same heading (text 1) on each side, like shown in the picture below which was created in publisher?
I have already looked into coloring the marginpar with tikz, but i am unable to get the desired result.
tikz-pgf
tikz-pgf
asked Nov 23 at 20:20
JTHG
133
133
1
Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
– nidhin
Nov 23 at 20:32
add a comment |
1
Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
– nidhin
Nov 23 at 20:32
1
1
Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
– nidhin
Nov 23 at 20:32
Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
– nidhin
Nov 23 at 20:32
add a comment |
3 Answers
3
active
oldest
votes
up vote
7
down vote
accepted
Here is an option using eso-pic
to place the sidebar, top bar and text using positioning relative to the text block:
documentclass{article}
usepackage{xcolor,eso-pic}
usepackage{lipsum}
definecolor{sidebarcolour}{RGB}{248,203,173}
definecolor{toprulecolour}{RGB}{192,0,0}
pagestyle{empty}
AddToShipoutPictureFG{%
AtTextLowerLeft{%
% Side bar
makebox[0pt][r]{%
textcolor{sidebarcolour}{rule[-5baselineskip]{marginparwidth}{dimexprtextheight+5baselineskip}}%
hspace{10pt}%
}%
}%
AtTextUpperLeft{%
% Top bar
hspace{-dimexprmarginparwidth+10pt}%
textcolor{toprulecolour}{rule{dimexprmarginparwidth+textwidth+20pt}{2baselineskip}}%
}%
AtTextUpperLeft{%
% Top text
makebox[textwidth]{raisebox{3baselineskip}{Large Text}}%
}%
}
begin{document}
sloppy % Just for this example
lipsum[1-50]
end{document}
Lengths and other positioning can be changed as needed.
add a comment |
up vote
3
down vote
Welcome to TeX.SE! Here is a possible way. I am not claiming that this is the most elegant way.
documentclass{article}
usepackage{tikzpagenodes,eso-pic}
newcommand{PageTitle}[1]{xdefmyPageTitle{#1}}
AddToShipoutPictureBG{%
begin{tikzpicture}[overlay,remember picture]
fill[orange!70] (current page.south west) rectangle
([xshift=-2mm,yshift=1mm]current page text area.north west);
fill[red] ([yshift=1mm]current page text area.north -| current page.west)
rectangle ([yshift=11mm]current page text area.north -| current page.east);
node[anchor=south] at ([yshift=11mm]current page text area.north) {myPageTitle};
end{tikzpicture}}
usepackage{lipsum}
begin{document}
PageTitle{Some text}
lipsum[1-6]
PageTitle{Some other text}
lipsum[7-8]
end{document}
add a comment |
up vote
1
down vote
Using tcolorbox
:
documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{tikz,tcolorbox}
tcbuselibrary{skins,breakable}
usepackage{lipsum}
begin{document}
begin{tcolorbox}[sharp corners,boxrule=0mm,colback=white,colframe=red!70!black,title={strut},
titlerule=6mm,left=0pt,right=0pt,top=0pt,]
begin{tcolorbox}[enhanced,breakable,sharp corners,
boxrule=0mm,right=0pt,
leftrule=3cm,grow to left by=1mm,
interior style={fill=white},
frame style={fill=red, fill opacity=0.15},
title style={fill=red, fill opacity=0.9},
]
lipsum[1-5]
end{tcolorbox}
end{tcolorbox}
end{document}
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
Here is an option using eso-pic
to place the sidebar, top bar and text using positioning relative to the text block:
documentclass{article}
usepackage{xcolor,eso-pic}
usepackage{lipsum}
definecolor{sidebarcolour}{RGB}{248,203,173}
definecolor{toprulecolour}{RGB}{192,0,0}
pagestyle{empty}
AddToShipoutPictureFG{%
AtTextLowerLeft{%
% Side bar
makebox[0pt][r]{%
textcolor{sidebarcolour}{rule[-5baselineskip]{marginparwidth}{dimexprtextheight+5baselineskip}}%
hspace{10pt}%
}%
}%
AtTextUpperLeft{%
% Top bar
hspace{-dimexprmarginparwidth+10pt}%
textcolor{toprulecolour}{rule{dimexprmarginparwidth+textwidth+20pt}{2baselineskip}}%
}%
AtTextUpperLeft{%
% Top text
makebox[textwidth]{raisebox{3baselineskip}{Large Text}}%
}%
}
begin{document}
sloppy % Just for this example
lipsum[1-50]
end{document}
Lengths and other positioning can be changed as needed.
add a comment |
up vote
7
down vote
accepted
Here is an option using eso-pic
to place the sidebar, top bar and text using positioning relative to the text block:
documentclass{article}
usepackage{xcolor,eso-pic}
usepackage{lipsum}
definecolor{sidebarcolour}{RGB}{248,203,173}
definecolor{toprulecolour}{RGB}{192,0,0}
pagestyle{empty}
AddToShipoutPictureFG{%
AtTextLowerLeft{%
% Side bar
makebox[0pt][r]{%
textcolor{sidebarcolour}{rule[-5baselineskip]{marginparwidth}{dimexprtextheight+5baselineskip}}%
hspace{10pt}%
}%
}%
AtTextUpperLeft{%
% Top bar
hspace{-dimexprmarginparwidth+10pt}%
textcolor{toprulecolour}{rule{dimexprmarginparwidth+textwidth+20pt}{2baselineskip}}%
}%
AtTextUpperLeft{%
% Top text
makebox[textwidth]{raisebox{3baselineskip}{Large Text}}%
}%
}
begin{document}
sloppy % Just for this example
lipsum[1-50]
end{document}
Lengths and other positioning can be changed as needed.
add a comment |
up vote
7
down vote
accepted
up vote
7
down vote
accepted
Here is an option using eso-pic
to place the sidebar, top bar and text using positioning relative to the text block:
documentclass{article}
usepackage{xcolor,eso-pic}
usepackage{lipsum}
definecolor{sidebarcolour}{RGB}{248,203,173}
definecolor{toprulecolour}{RGB}{192,0,0}
pagestyle{empty}
AddToShipoutPictureFG{%
AtTextLowerLeft{%
% Side bar
makebox[0pt][r]{%
textcolor{sidebarcolour}{rule[-5baselineskip]{marginparwidth}{dimexprtextheight+5baselineskip}}%
hspace{10pt}%
}%
}%
AtTextUpperLeft{%
% Top bar
hspace{-dimexprmarginparwidth+10pt}%
textcolor{toprulecolour}{rule{dimexprmarginparwidth+textwidth+20pt}{2baselineskip}}%
}%
AtTextUpperLeft{%
% Top text
makebox[textwidth]{raisebox{3baselineskip}{Large Text}}%
}%
}
begin{document}
sloppy % Just for this example
lipsum[1-50]
end{document}
Lengths and other positioning can be changed as needed.
Here is an option using eso-pic
to place the sidebar, top bar and text using positioning relative to the text block:
documentclass{article}
usepackage{xcolor,eso-pic}
usepackage{lipsum}
definecolor{sidebarcolour}{RGB}{248,203,173}
definecolor{toprulecolour}{RGB}{192,0,0}
pagestyle{empty}
AddToShipoutPictureFG{%
AtTextLowerLeft{%
% Side bar
makebox[0pt][r]{%
textcolor{sidebarcolour}{rule[-5baselineskip]{marginparwidth}{dimexprtextheight+5baselineskip}}%
hspace{10pt}%
}%
}%
AtTextUpperLeft{%
% Top bar
hspace{-dimexprmarginparwidth+10pt}%
textcolor{toprulecolour}{rule{dimexprmarginparwidth+textwidth+20pt}{2baselineskip}}%
}%
AtTextUpperLeft{%
% Top text
makebox[textwidth]{raisebox{3baselineskip}{Large Text}}%
}%
}
begin{document}
sloppy % Just for this example
lipsum[1-50]
end{document}
Lengths and other positioning can be changed as needed.
answered Nov 23 at 21:27
Werner
434k609531636
434k609531636
add a comment |
add a comment |
up vote
3
down vote
Welcome to TeX.SE! Here is a possible way. I am not claiming that this is the most elegant way.
documentclass{article}
usepackage{tikzpagenodes,eso-pic}
newcommand{PageTitle}[1]{xdefmyPageTitle{#1}}
AddToShipoutPictureBG{%
begin{tikzpicture}[overlay,remember picture]
fill[orange!70] (current page.south west) rectangle
([xshift=-2mm,yshift=1mm]current page text area.north west);
fill[red] ([yshift=1mm]current page text area.north -| current page.west)
rectangle ([yshift=11mm]current page text area.north -| current page.east);
node[anchor=south] at ([yshift=11mm]current page text area.north) {myPageTitle};
end{tikzpicture}}
usepackage{lipsum}
begin{document}
PageTitle{Some text}
lipsum[1-6]
PageTitle{Some other text}
lipsum[7-8]
end{document}
add a comment |
up vote
3
down vote
Welcome to TeX.SE! Here is a possible way. I am not claiming that this is the most elegant way.
documentclass{article}
usepackage{tikzpagenodes,eso-pic}
newcommand{PageTitle}[1]{xdefmyPageTitle{#1}}
AddToShipoutPictureBG{%
begin{tikzpicture}[overlay,remember picture]
fill[orange!70] (current page.south west) rectangle
([xshift=-2mm,yshift=1mm]current page text area.north west);
fill[red] ([yshift=1mm]current page text area.north -| current page.west)
rectangle ([yshift=11mm]current page text area.north -| current page.east);
node[anchor=south] at ([yshift=11mm]current page text area.north) {myPageTitle};
end{tikzpicture}}
usepackage{lipsum}
begin{document}
PageTitle{Some text}
lipsum[1-6]
PageTitle{Some other text}
lipsum[7-8]
end{document}
add a comment |
up vote
3
down vote
up vote
3
down vote
Welcome to TeX.SE! Here is a possible way. I am not claiming that this is the most elegant way.
documentclass{article}
usepackage{tikzpagenodes,eso-pic}
newcommand{PageTitle}[1]{xdefmyPageTitle{#1}}
AddToShipoutPictureBG{%
begin{tikzpicture}[overlay,remember picture]
fill[orange!70] (current page.south west) rectangle
([xshift=-2mm,yshift=1mm]current page text area.north west);
fill[red] ([yshift=1mm]current page text area.north -| current page.west)
rectangle ([yshift=11mm]current page text area.north -| current page.east);
node[anchor=south] at ([yshift=11mm]current page text area.north) {myPageTitle};
end{tikzpicture}}
usepackage{lipsum}
begin{document}
PageTitle{Some text}
lipsum[1-6]
PageTitle{Some other text}
lipsum[7-8]
end{document}
Welcome to TeX.SE! Here is a possible way. I am not claiming that this is the most elegant way.
documentclass{article}
usepackage{tikzpagenodes,eso-pic}
newcommand{PageTitle}[1]{xdefmyPageTitle{#1}}
AddToShipoutPictureBG{%
begin{tikzpicture}[overlay,remember picture]
fill[orange!70] (current page.south west) rectangle
([xshift=-2mm,yshift=1mm]current page text area.north west);
fill[red] ([yshift=1mm]current page text area.north -| current page.west)
rectangle ([yshift=11mm]current page text area.north -| current page.east);
node[anchor=south] at ([yshift=11mm]current page text area.north) {myPageTitle};
end{tikzpicture}}
usepackage{lipsum}
begin{document}
PageTitle{Some text}
lipsum[1-6]
PageTitle{Some other text}
lipsum[7-8]
end{document}
answered Nov 23 at 20:35
marmot
81.2k491173
81.2k491173
add a comment |
add a comment |
up vote
1
down vote
Using tcolorbox
:
documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{tikz,tcolorbox}
tcbuselibrary{skins,breakable}
usepackage{lipsum}
begin{document}
begin{tcolorbox}[sharp corners,boxrule=0mm,colback=white,colframe=red!70!black,title={strut},
titlerule=6mm,left=0pt,right=0pt,top=0pt,]
begin{tcolorbox}[enhanced,breakable,sharp corners,
boxrule=0mm,right=0pt,
leftrule=3cm,grow to left by=1mm,
interior style={fill=white},
frame style={fill=red, fill opacity=0.15},
title style={fill=red, fill opacity=0.9},
]
lipsum[1-5]
end{tcolorbox}
end{tcolorbox}
end{document}
add a comment |
up vote
1
down vote
Using tcolorbox
:
documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{tikz,tcolorbox}
tcbuselibrary{skins,breakable}
usepackage{lipsum}
begin{document}
begin{tcolorbox}[sharp corners,boxrule=0mm,colback=white,colframe=red!70!black,title={strut},
titlerule=6mm,left=0pt,right=0pt,top=0pt,]
begin{tcolorbox}[enhanced,breakable,sharp corners,
boxrule=0mm,right=0pt,
leftrule=3cm,grow to left by=1mm,
interior style={fill=white},
frame style={fill=red, fill opacity=0.15},
title style={fill=red, fill opacity=0.9},
]
lipsum[1-5]
end{tcolorbox}
end{tcolorbox}
end{document}
add a comment |
up vote
1
down vote
up vote
1
down vote
Using tcolorbox
:
documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{tikz,tcolorbox}
tcbuselibrary{skins,breakable}
usepackage{lipsum}
begin{document}
begin{tcolorbox}[sharp corners,boxrule=0mm,colback=white,colframe=red!70!black,title={strut},
titlerule=6mm,left=0pt,right=0pt,top=0pt,]
begin{tcolorbox}[enhanced,breakable,sharp corners,
boxrule=0mm,right=0pt,
leftrule=3cm,grow to left by=1mm,
interior style={fill=white},
frame style={fill=red, fill opacity=0.15},
title style={fill=red, fill opacity=0.9},
]
lipsum[1-5]
end{tcolorbox}
end{tcolorbox}
end{document}
Using tcolorbox
:
documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{tikz,tcolorbox}
tcbuselibrary{skins,breakable}
usepackage{lipsum}
begin{document}
begin{tcolorbox}[sharp corners,boxrule=0mm,colback=white,colframe=red!70!black,title={strut},
titlerule=6mm,left=0pt,right=0pt,top=0pt,]
begin{tcolorbox}[enhanced,breakable,sharp corners,
boxrule=0mm,right=0pt,
leftrule=3cm,grow to left by=1mm,
interior style={fill=white},
frame style={fill=red, fill opacity=0.15},
title style={fill=red, fill opacity=0.9},
]
lipsum[1-5]
end{tcolorbox}
end{tcolorbox}
end{document}
answered Nov 23 at 22:38
nidhin
2,189923
2,189923
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%2f461474%2fcoloured-box-on-top-and-left-side-of-text%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
Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
– nidhin
Nov 23 at 20:32