-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create an environment for colored boxes #27
Comments
You can simply define your own environment. For example \documentclass{article}
\usepackage{xcolor}
\NewDocumentEnvironment{cb}{O{blue}b}{%
\colorbox{#1}{#2}%
}
\begin{document}
\begin{cb}
Test
\end{cb}
\begin{cb}[red]
Test
\end{cb}
\end{document} |
@Udi-Fogiel It doesn't give the expected result in case long text: it is composed on a single line and protrudes into the right margin. An improvement would be to rely on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be nice if in addition to the
colorbox
command, one could also have it as an environment:This is especially handy in a setting where the content is long, or if one wants to define own environments using colored boxes.
The package tcolorbox provides such a functionality, but it seems a bit wasteful to load it in addition to
xcolor
.The text was updated successfully, but these errors were encountered: