Make a ribbon box with text in it











up vote
0
down vote

favorite












I'm pretty novice in LaTeX and use overleaf to write.



Is there any way that I could do this kind of box with a arbitrary text in it that is not linked to any title or chapter - just a black box with plain text in it?



I've tried to modify this code in the answer, but I only seem to break it...



How to make a chapter heading like this










share|improve this question






















  • rule[-15pt]{2cm}{1.5cm}llap{color{white} III } Gets me closer, but can't really get it to appear at the very end of the side of the page
    – Myggan
    Dec 6 at 10:12












  • hspace{13.9cm}raggedleftrule[-15pt]{3cm}{1.5cm}llap{Hugecolor{white} III } This seems to work, but seems like an ugly solution?
    – Myggan
    Dec 6 at 10:24















up vote
0
down vote

favorite












I'm pretty novice in LaTeX and use overleaf to write.



Is there any way that I could do this kind of box with a arbitrary text in it that is not linked to any title or chapter - just a black box with plain text in it?



I've tried to modify this code in the answer, but I only seem to break it...



How to make a chapter heading like this










share|improve this question






















  • rule[-15pt]{2cm}{1.5cm}llap{color{white} III } Gets me closer, but can't really get it to appear at the very end of the side of the page
    – Myggan
    Dec 6 at 10:12












  • hspace{13.9cm}raggedleftrule[-15pt]{3cm}{1.5cm}llap{Hugecolor{white} III } This seems to work, but seems like an ugly solution?
    – Myggan
    Dec 6 at 10:24













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm pretty novice in LaTeX and use overleaf to write.



Is there any way that I could do this kind of box with a arbitrary text in it that is not linked to any title or chapter - just a black box with plain text in it?



I've tried to modify this code in the answer, but I only seem to break it...



How to make a chapter heading like this










share|improve this question













I'm pretty novice in LaTeX and use overleaf to write.



Is there any way that I could do this kind of box with a arbitrary text in it that is not linked to any title or chapter - just a black box with plain text in it?



I've tried to modify this code in the answer, but I only seem to break it...



How to make a chapter heading like this







rules box






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 5 at 14:01









Myggan

31




31












  • rule[-15pt]{2cm}{1.5cm}llap{color{white} III } Gets me closer, but can't really get it to appear at the very end of the side of the page
    – Myggan
    Dec 6 at 10:12












  • hspace{13.9cm}raggedleftrule[-15pt]{3cm}{1.5cm}llap{Hugecolor{white} III } This seems to work, but seems like an ugly solution?
    – Myggan
    Dec 6 at 10:24


















  • rule[-15pt]{2cm}{1.5cm}llap{color{white} III } Gets me closer, but can't really get it to appear at the very end of the side of the page
    – Myggan
    Dec 6 at 10:12












  • hspace{13.9cm}raggedleftrule[-15pt]{3cm}{1.5cm}llap{Hugecolor{white} III } This seems to work, but seems like an ugly solution?
    – Myggan
    Dec 6 at 10:24
















rule[-15pt]{2cm}{1.5cm}llap{color{white} III } Gets me closer, but can't really get it to appear at the very end of the side of the page
– Myggan
Dec 6 at 10:12






rule[-15pt]{2cm}{1.5cm}llap{color{white} III } Gets me closer, but can't really get it to appear at the very end of the side of the page
– Myggan
Dec 6 at 10:12














hspace{13.9cm}raggedleftrule[-15pt]{3cm}{1.5cm}llap{Hugecolor{white} III } This seems to work, but seems like an ugly solution?
– Myggan
Dec 6 at 10:24




hspace{13.9cm}raggedleftrule[-15pt]{3cm}{1.5cm}llap{Hugecolor{white} III } This seems to work, but seems like an ugly solution?
– Myggan
Dec 6 at 10:24










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










As you didn't specify your exact requirements, here's a simple ribbon version that puts a black box with white text to the left or right side of the paragraph text.



You can use ribbonsep to specify the horizontal space between the text and the ribbon. A ribbon should always be used at the begin of a new paragraph, as it uses noindent to get its placement right. That also means that you need to use indent explicitly if the following paragraph text should be indented. Note that the code hasn't been tested much, so there are several chances for optimization/extensions here.



documentclass{article}
usepackage{lipsum}
usepackage{xcolor}

newlengthribbonsep
ribbonsep=12pt

newcommandribbonleft{%
noindent
llap{%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][r]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
hspace*{ribbonsep}%
}%
}

newcommandribbonright{%
noindent
rlap{%
hspace*{dimexprtextwidth+ribbonsep}%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][l]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
}%
}

begin{document}
lipsum[1]

ribbonleftindent
lipsum[2]

ribbonrightindent
lipsum[3]
end{document}


enter image description here






share|improve this answer





















  • Thanks a lot! This seems to do the trick!
    – Myggan
    yesterday











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%2f463326%2fmake-a-ribbon-box-with-text-in-it%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








up vote
0
down vote



accepted










As you didn't specify your exact requirements, here's a simple ribbon version that puts a black box with white text to the left or right side of the paragraph text.



You can use ribbonsep to specify the horizontal space between the text and the ribbon. A ribbon should always be used at the begin of a new paragraph, as it uses noindent to get its placement right. That also means that you need to use indent explicitly if the following paragraph text should be indented. Note that the code hasn't been tested much, so there are several chances for optimization/extensions here.



documentclass{article}
usepackage{lipsum}
usepackage{xcolor}

newlengthribbonsep
ribbonsep=12pt

newcommandribbonleft{%
noindent
llap{%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][r]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
hspace*{ribbonsep}%
}%
}

newcommandribbonright{%
noindent
rlap{%
hspace*{dimexprtextwidth+ribbonsep}%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][l]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
}%
}

begin{document}
lipsum[1]

ribbonleftindent
lipsum[2]

ribbonrightindent
lipsum[3]
end{document}


enter image description here






share|improve this answer





















  • Thanks a lot! This seems to do the trick!
    – Myggan
    yesterday















up vote
0
down vote



accepted










As you didn't specify your exact requirements, here's a simple ribbon version that puts a black box with white text to the left or right side of the paragraph text.



You can use ribbonsep to specify the horizontal space between the text and the ribbon. A ribbon should always be used at the begin of a new paragraph, as it uses noindent to get its placement right. That also means that you need to use indent explicitly if the following paragraph text should be indented. Note that the code hasn't been tested much, so there are several chances for optimization/extensions here.



documentclass{article}
usepackage{lipsum}
usepackage{xcolor}

newlengthribbonsep
ribbonsep=12pt

newcommandribbonleft{%
noindent
llap{%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][r]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
hspace*{ribbonsep}%
}%
}

newcommandribbonright{%
noindent
rlap{%
hspace*{dimexprtextwidth+ribbonsep}%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][l]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
}%
}

begin{document}
lipsum[1]

ribbonleftindent
lipsum[2]

ribbonrightindent
lipsum[3]
end{document}


enter image description here






share|improve this answer





















  • Thanks a lot! This seems to do the trick!
    – Myggan
    yesterday













up vote
0
down vote



accepted







up vote
0
down vote



accepted






As you didn't specify your exact requirements, here's a simple ribbon version that puts a black box with white text to the left or right side of the paragraph text.



You can use ribbonsep to specify the horizontal space between the text and the ribbon. A ribbon should always be used at the begin of a new paragraph, as it uses noindent to get its placement right. That also means that you need to use indent explicitly if the following paragraph text should be indented. Note that the code hasn't been tested much, so there are several chances for optimization/extensions here.



documentclass{article}
usepackage{lipsum}
usepackage{xcolor}

newlengthribbonsep
ribbonsep=12pt

newcommandribbonleft{%
noindent
llap{%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][r]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
hspace*{ribbonsep}%
}%
}

newcommandribbonright{%
noindent
rlap{%
hspace*{dimexprtextwidth+ribbonsep}%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][l]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
}%
}

begin{document}
lipsum[1]

ribbonleftindent
lipsum[2]

ribbonrightindent
lipsum[3]
end{document}


enter image description here






share|improve this answer












As you didn't specify your exact requirements, here's a simple ribbon version that puts a black box with white text to the left or right side of the paragraph text.



You can use ribbonsep to specify the horizontal space between the text and the ribbon. A ribbon should always be used at the begin of a new paragraph, as it uses noindent to get its placement right. That also means that you need to use indent explicitly if the following paragraph text should be indented. Note that the code hasn't been tested much, so there are several chances for optimization/extensions here.



documentclass{article}
usepackage{lipsum}
usepackage{xcolor}

newlengthribbonsep
ribbonsep=12pt

newcommandribbonleft{%
noindent
llap{%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][r]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
hspace*{ribbonsep}%
}%
}

newcommandribbonright{%
noindent
rlap{%
hspace*{dimexprtextwidth+ribbonsep}%
smash{vtop{%
kern-baselineskip
hbox{colorbox{black}{makebox[dimexpr 1in+hoffset+oddsidemargin-ribbonsep][l]{%
Hugetextcolor{white}{bfseries NOTE}%
rule[-5pt]{0pt}{baselineskip}%
}}}%
}}%
}%
}

begin{document}
lipsum[1]

ribbonleftindent
lipsum[2]

ribbonrightindent
lipsum[3]
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered yesterday









siracusa

4,81511228




4,81511228












  • Thanks a lot! This seems to do the trick!
    – Myggan
    yesterday


















  • Thanks a lot! This seems to do the trick!
    – Myggan
    yesterday
















Thanks a lot! This seems to do the trick!
– Myggan
yesterday




Thanks a lot! This seems to do the trick!
– Myggan
yesterday


















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%2f463326%2fmake-a-ribbon-box-with-text-in-it%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

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

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