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.



Desired result










share|improve this question







New contributor




JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
    – nidhin
    yesterday















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.



Desired result










share|improve this question







New contributor




JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
    – nidhin
    yesterday













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.



Desired result










share|improve this question







New contributor




JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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.



Desired result







tikz-pgf






share|improve this question







New contributor




JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









JTHG

133




133




New contributor




JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






JTHG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
    – nidhin
    yesterday














  • 1




    Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
    – nidhin
    yesterday








1




1




Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
– nidhin
yesterday




Welcome to TeX.SE. Please add a MWE showing what you have tried and where you are stuck at.
– nidhin
yesterday










3 Answers
3






active

oldest

votes

















up vote
5
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:



enter image description here



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.






share|improve this answer




























    up vote
    2
    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}


    enter image description here



    enter image description here






    share|improve this answer




























      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}


      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
        });


        }
        });






        JTHG is a new contributor. Be nice, and check out our Code of Conduct.










         

        draft saved


        draft discarded


















        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

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        5
        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:



        enter image description here



        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.






        share|improve this answer

























          up vote
          5
          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:



          enter image description here



          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.






          share|improve this answer























            up vote
            5
            down vote



            accepted







            up vote
            5
            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:



            enter image description here



            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.






            share|improve this answer












            Here is an option using eso-pic to place the sidebar, top bar and text using positioning relative to the text block:



            enter image description here



            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered yesterday









            Werner

            431k599501628




            431k599501628






















                up vote
                2
                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}


                enter image description here



                enter image description here






                share|improve this answer

























                  up vote
                  2
                  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}


                  enter image description here



                  enter image description here






                  share|improve this answer























                    up vote
                    2
                    down vote










                    up vote
                    2
                    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}


                    enter image description here



                    enter image description here






                    share|improve this answer












                    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}


                    enter image description here



                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered yesterday









                    marmot

                    77.7k487166




                    77.7k487166






















                        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}


                        enter image description here






                        share|improve this answer

























                          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}


                          enter image description here






                          share|improve this answer























                            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}


                            enter image description here






                            share|improve this answer












                            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}


                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered yesterday









                            nidhin

                            1,700921




                            1,700921






















                                JTHG is a new contributor. Be nice, and check out our Code of Conduct.










                                 

                                draft saved


                                draft discarded


















                                JTHG is a new contributor. Be nice, and check out our Code of Conduct.













                                JTHG is a new contributor. Be nice, and check out our Code of Conduct.












                                JTHG is a new contributor. Be nice, and check out our Code of Conduct.















                                 


                                draft saved


                                draft discarded














                                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





















































                                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

                                Accessing regular linux commands in Huawei's Dopra Linux

                                Can't connect RFCOMM socket: Host is down

                                Kernel panic - not syncing: Fatal Exception in Interrupt