How to reduce colorbox width for text?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












Here's the MWE:



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1

begindocument
The board connectors are called tpGND and tpVDD.
enddocument


This results in



enter image description here



How do I reduce the width of the gray area left and right of the highlighted text? I think there's a bit too much space, particularly at the end before the period. I don't mind leaving it as is but if there is a simple answer that takes less than 5 minutes (I don't want to waste anybody's time), I'd highly appreciate it :-)







share|improve this question




















  • setlengthfboxsep0pt may help you without disturbing your existing code....
    – MadyYuvi
    Aug 26 at 9:27














up vote
2
down vote

favorite












Here's the MWE:



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1

begindocument
The board connectors are called tpGND and tpVDD.
enddocument


This results in



enter image description here



How do I reduce the width of the gray area left and right of the highlighted text? I think there's a bit too much space, particularly at the end before the period. I don't mind leaving it as is but if there is a simple answer that takes less than 5 minutes (I don't want to waste anybody's time), I'd highly appreciate it :-)







share|improve this question




















  • setlengthfboxsep0pt may help you without disturbing your existing code....
    – MadyYuvi
    Aug 26 at 9:27












up vote
2
down vote

favorite









up vote
2
down vote

favorite











Here's the MWE:



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1

begindocument
The board connectors are called tpGND and tpVDD.
enddocument


This results in



enter image description here



How do I reduce the width of the gray area left and right of the highlighted text? I think there's a bit too much space, particularly at the end before the period. I don't mind leaving it as is but if there is a simple answer that takes less than 5 minutes (I don't want to waste anybody's time), I'd highly appreciate it :-)







share|improve this question












Here's the MWE:



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1

begindocument
The board connectors are called tpGND and tpVDD.
enddocument


This results in



enter image description here



How do I reduce the width of the gray area left and right of the highlighted text? I think there's a bit too much space, particularly at the end before the period. I don't mind leaving it as is but if there is a simple answer that takes less than 5 minutes (I don't want to waste anybody's time), I'd highly appreciate it :-)









share|improve this question











share|improve this question




share|improve this question










asked Aug 26 at 7:57









Hansel

895




895











  • setlengthfboxsep0pt may help you without disturbing your existing code....
    – MadyYuvi
    Aug 26 at 9:27
















  • setlengthfboxsep0pt may help you without disturbing your existing code....
    – MadyYuvi
    Aug 26 at 9:27















setlengthfboxsep0pt may help you without disturbing your existing code....
– MadyYuvi
Aug 26 at 9:27




setlengthfboxsep0pt may help you without disturbing your existing code....
– MadyYuvi
Aug 26 at 9:27










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










The following solution shows two approaches: (1) use colorbox and reduce the spacing at all sides and (2) use tcbox from tcolorbox and change the sides independently.



boxing



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1
setlengthfboxsep1pt

usepackage[skins]tcolorbox
newtcboxtcbtphbox, on line, colback=tpgray, enhanced, frame hidden, boxrule=0pt,
top=1pt, bottom=1pt, right=-2pt, left=-2pt, sharp corners

begindocument
The board connectors are called tpGND and tpVDD.

The board connectors are called tcbtpGND and tcbtpVDD.
enddocument





share|improve this answer




















  • Dang, that's cool! And now I can even use rounded corners which makes it look even better. Very nice. Thanks a lot for your quick help. This community is awesome.
    – Hansel
    Aug 26 at 8:24










  • @Hansel You're welcome :)
    – TeXnician
    Aug 26 at 8:26










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: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
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%2f447758%2fhow-to-reduce-colorbox-width-for-text%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










The following solution shows two approaches: (1) use colorbox and reduce the spacing at all sides and (2) use tcbox from tcolorbox and change the sides independently.



boxing



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1
setlengthfboxsep1pt

usepackage[skins]tcolorbox
newtcboxtcbtphbox, on line, colback=tpgray, enhanced, frame hidden, boxrule=0pt,
top=1pt, bottom=1pt, right=-2pt, left=-2pt, sharp corners

begindocument
The board connectors are called tpGND and tpVDD.

The board connectors are called tcbtpGND and tcbtpVDD.
enddocument





share|improve this answer




















  • Dang, that's cool! And now I can even use rounded corners which makes it look even better. Very nice. Thanks a lot for your quick help. This community is awesome.
    – Hansel
    Aug 26 at 8:24










  • @Hansel You're welcome :)
    – TeXnician
    Aug 26 at 8:26














up vote
4
down vote



accepted










The following solution shows two approaches: (1) use colorbox and reduce the spacing at all sides and (2) use tcbox from tcolorbox and change the sides independently.



boxing



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1
setlengthfboxsep1pt

usepackage[skins]tcolorbox
newtcboxtcbtphbox, on line, colback=tpgray, enhanced, frame hidden, boxrule=0pt,
top=1pt, bottom=1pt, right=-2pt, left=-2pt, sharp corners

begindocument
The board connectors are called tpGND and tpVDD.

The board connectors are called tcbtpGND and tcbtpVDD.
enddocument





share|improve this answer




















  • Dang, that's cool! And now I can even use rounded corners which makes it look even better. Very nice. Thanks a lot for your quick help. This community is awesome.
    – Hansel
    Aug 26 at 8:24










  • @Hansel You're welcome :)
    – TeXnician
    Aug 26 at 8:26












up vote
4
down vote



accepted







up vote
4
down vote



accepted






The following solution shows two approaches: (1) use colorbox and reduce the spacing at all sides and (2) use tcbox from tcolorbox and change the sides independently.



boxing



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1
setlengthfboxsep1pt

usepackage[skins]tcolorbox
newtcboxtcbtphbox, on line, colback=tpgray, enhanced, frame hidden, boxrule=0pt,
top=1pt, bottom=1pt, right=-2pt, left=-2pt, sharp corners

begindocument
The board connectors are called tpGND and tpVDD.

The board connectors are called tcbtpGND and tcbtpVDD.
enddocument





share|improve this answer












The following solution shows two approaches: (1) use colorbox and reduce the spacing at all sides and (2) use tcbox from tcolorbox and change the sides independently.



boxing



documentclass[a4paper, 12pt]article

renewcommandrmdefaultptm
usepackage[table]xcolor

definecolortpgraygray0.90
newcommandtp[1]colorboxtpgray#1
setlengthfboxsep1pt

usepackage[skins]tcolorbox
newtcboxtcbtphbox, on line, colback=tpgray, enhanced, frame hidden, boxrule=0pt,
top=1pt, bottom=1pt, right=-2pt, left=-2pt, sharp corners

begindocument
The board connectors are called tpGND and tpVDD.

The board connectors are called tcbtpGND and tcbtpVDD.
enddocument






share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 26 at 8:15









TeXnician

20.4k52880




20.4k52880











  • Dang, that's cool! And now I can even use rounded corners which makes it look even better. Very nice. Thanks a lot for your quick help. This community is awesome.
    – Hansel
    Aug 26 at 8:24










  • @Hansel You're welcome :)
    – TeXnician
    Aug 26 at 8:26
















  • Dang, that's cool! And now I can even use rounded corners which makes it look even better. Very nice. Thanks a lot for your quick help. This community is awesome.
    – Hansel
    Aug 26 at 8:24










  • @Hansel You're welcome :)
    – TeXnician
    Aug 26 at 8:26















Dang, that's cool! And now I can even use rounded corners which makes it look even better. Very nice. Thanks a lot for your quick help. This community is awesome.
– Hansel
Aug 26 at 8:24




Dang, that's cool! And now I can even use rounded corners which makes it look even better. Very nice. Thanks a lot for your quick help. This community is awesome.
– Hansel
Aug 26 at 8:24












@Hansel You're welcome :)
– TeXnician
Aug 26 at 8:26




@Hansel You're welcome :)
– TeXnician
Aug 26 at 8:26

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f447758%2fhow-to-reduce-colorbox-width-for-text%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

What does second last employer means? [closed]

One-line joke