0

how to make a box with grey color background using fbox in latex?

I have the following code but have no idea how to change the background into grey color.

\fbox{$\phantom{\num{665}}$}

Appreciate for any help

  • 1
    \colorbox{grey}{$\phantom{\num{665}}$} should do the trick. – Bernard Sep 23 '19 at 9:31
  • @Bernard Sorry, I entered my answer before read your comment... – MadyYuvi Sep 23 '19 at 9:37
  • Hi Bernard, for some reason your suggestion not working, I dont know where I do wrong – polosepian Sep 23 '19 at 9:45
  • Maybe something conflicting in the rest of your code? Is \num defined? – Bernard Sep 23 '19 at 9:54
  • I got the following error: Undefined contol sequence – polosepian Sep 23 '19 at 10:02
1

Please try with \colorbox{gray!50}{\hbox to 5pc{\vbox to 5pc{}}}

Edit

Please try with \fcolorbox{black}{gray!50}{\hbox to 5pc{\vbox to 5pc{}}}

  • Thanks, it work – polosepian Sep 23 '19 at 9:43
  • 1
    Border color means you need to get the outer rule color ? Please confirm if my understanding is correct... – MadyYuvi Sep 23 '19 at 10:08
  • 1
    @polosepian Please refer the edited answer... – MadyYuvi Sep 23 '19 at 10:12
  • 1
    Thanks and really appreciate it – polosepian Sep 23 '19 at 10:14
  • 1
    Its my pleasure to help... Please read the link en.wikibooks.org/wiki/LaTeX/Boxes#colorbox_and_fcolorbox about more possible boxes in LaTeX – MadyYuvi Sep 23 '19 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.