Getting the width of the current containerAdjusting the width of the matrixfine-tuning of makebox widthSet...
Which country benefited the most from UN Security Council vetoes?
strTok function (thread safe, supports empty tokens, doesn't change string)
Is it legal for company to use my work email to pretend I still work there?
Codimension of non-flat locus
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
How much of data wrangling is a data scientist's job?
What's the point of deactivating Num Lock on login screens?
Modeling an IP Address
Intersection point of 2 lines defined by 2 points each
How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?
Why can't we play rap on piano?
Is it possible to do 50 km distance without any previous training?
What do the dots in this tr command do: tr .............A-Z A-ZA-Z <<< "JVPQBOV" (with 13 dots)
Watching something be written to a file live with tail
How does quantile regression compare to logistic regression with the variable split at the quantile?
How is it possible to have an ability score that is less than 3?
Are the number of citations and number of published articles the most important criteria for a tenure promotion?
Arrow those variables!
Why is consensus so controversial in Britain?
Why are electrically insulating heatsinks so rare? Is it just cost?
Why do I get two different answers for this counting problem?
Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?
Was any UN Security Council vote triple-vetoed?
Fully-Firstable Anagram Sets
Getting the width of the current container
Adjusting the width of the matrixfine-tuning of makebox widthSet minipage width to the available spacehow to set sidebar color widthTable exceeds the page widthHow do I change the width of the table to the text width in Latex?URL reference width continues after marginWidth of the content inside `begin{center} … end{center}`Image matrix using the whole line width?Is there a global variable that reflects the current preferred table column's width?
I'm trying to create a generic command to write a solid heading. The width of the heading should fit into the containing environment in which the heading it rendered.
In the example below, the orange heading flows outside the table.
What command should I use to replace textwidth
in the solidheading so that it will always print a width that fits into either a paragraph width or inside a table column?
The code to produce this is as follows:
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{textwidth}{#2}}
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
width
add a comment |
I'm trying to create a generic command to write a solid heading. The width of the heading should fit into the containing environment in which the heading it rendered.
In the example below, the orange heading flows outside the table.
What command should I use to replace textwidth
in the solidheading so that it will always print a width that fits into either a paragraph width or inside a table column?
The code to produce this is as follows:
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{textwidth}{#2}}
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
width
add a comment |
I'm trying to create a generic command to write a solid heading. The width of the heading should fit into the containing environment in which the heading it rendered.
In the example below, the orange heading flows outside the table.
What command should I use to replace textwidth
in the solidheading so that it will always print a width that fits into either a paragraph width or inside a table column?
The code to produce this is as follows:
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{textwidth}{#2}}
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
width
I'm trying to create a generic command to write a solid heading. The width of the heading should fit into the containing environment in which the heading it rendered.
In the example below, the orange heading flows outside the table.
What command should I use to replace textwidth
in the solidheading so that it will always print a width that fits into either a paragraph width or inside a table column?
The code to produce this is as follows:
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{textwidth}{#2}}
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
width
width
asked 4 hours ago
JackJack
445159
445159
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can use linewidth
instead of textwidth
:
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth <==============
vskip1ex
}
With the complete code
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
you the result:
Thanks Kurt, sometimes the answer is so simple ;-)
– Jack
3 hours ago
@Jack yes, sometimes it is :-)
– Kurt
2 hours 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%2f483452%2fgetting-the-width-of-the-current-container%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
You can use linewidth
instead of textwidth
:
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth <==============
vskip1ex
}
With the complete code
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
you the result:
Thanks Kurt, sometimes the answer is so simple ;-)
– Jack
3 hours ago
@Jack yes, sometimes it is :-)
– Kurt
2 hours ago
add a comment |
You can use linewidth
instead of textwidth
:
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth <==============
vskip1ex
}
With the complete code
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
you the result:
Thanks Kurt, sometimes the answer is so simple ;-)
– Jack
3 hours ago
@Jack yes, sometimes it is :-)
– Kurt
2 hours ago
add a comment |
You can use linewidth
instead of textwidth
:
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth <==============
vskip1ex
}
With the complete code
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
you the result:
You can use linewidth
instead of textwidth
:
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth <==============
vskip1ex
}
With the complete code
documentclass[12pt]{article}
usepackage{xcolor}
newcommand{solidheading}[2][yellow]{
noindent colorbox{#1}{parbox[t]{linewidth}{#2}} % textwidth
vskip1ex
}
usepackage{colortbl}
usepackage{fontawesome5}
newenvironment{notes}
{ noindent
begin{tabular}{!{color{black}vrule width 0.01textwidth}p{0.85textwidth}}
{cellcolor{gray}}
{LargefaEdit[regular]} bfseries{Notes}\
{cellcolor{lightgray}}
}
{
end{tabular}
}
begin{document}
solidheading[pink]{Heading outside Table}
begin{notes}
solidheading[orange]{Don't forget}
Smile and say hello.newline
Happy makes happy.
end{notes}
end{document}
you the result:
answered 3 hours ago
KurtKurt
40.8k950164
40.8k950164
Thanks Kurt, sometimes the answer is so simple ;-)
– Jack
3 hours ago
@Jack yes, sometimes it is :-)
– Kurt
2 hours ago
add a comment |
Thanks Kurt, sometimes the answer is so simple ;-)
– Jack
3 hours ago
@Jack yes, sometimes it is :-)
– Kurt
2 hours ago
Thanks Kurt, sometimes the answer is so simple ;-)
– Jack
3 hours ago
Thanks Kurt, sometimes the answer is so simple ;-)
– Jack
3 hours ago
@Jack yes, sometimes it is :-)
– Kurt
2 hours ago
@Jack yes, sometimes it is :-)
– Kurt
2 hours 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.
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%2f483452%2fgetting-the-width-of-the-current-container%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