\item The sum $3-\dfrac{3}{10}+\dfrac{3}{100}-\dfrac{3}{1000} 
      + \cdots + \dfrac{(-1)^k3}{10^k} + \cdots$ is closest to:
\item[(a)] $\dfrac{2}{e}$
\item[(b)] $2$
\item[(c)] $e$
\item[(d)] $e^2$
  • 3
    There is much too little information here to allow anyone to guess at what you want. Even a scanned image of a hand-drawn example would be helpful. Feb 15 '20 at 22:49
  • 2
    Welcome to tex.se! At the moment it's hard to understand what your question is. Could you please add a minimal working example and explain what you're looking for? You could for example add an illustration of your desired end result. You can also look for similar questions in the past, for example this one or this or this.
    – TivV
    Feb 15 '20 at 22:55
  • Welcome to TeX-SE. Please, inform a little bit more clear what you want, preferably with a MWE.
    – FHZ
    Feb 15 '20 at 23:04

Judging by the code snippet you posted, your document employs the amsmath package. This package provides a macro called \framebox, which (a) should be used in math mode and (b) places a rectangular frame around its argument. I'm assuming that this is what you want to achieve when you wrote that you wish to "put a box around one item" in an enumerate environment.

Two other methods for highlighting objects with color are provided by the xcolor package: \colorbox{<background color>}{<object>} and \fcolorbox{<frame color>}{<background color>}{<object>}. These macros may be used in either text or math mode.

There are still other methods for highlighting or placing box frames around objects. The earlier comment by @TivV points to several postings (and associated answers) that present such methods.

The following code (a) makes your code more LaTeX-idiomatic (e.g., by using \dots and \dotsb in lieu of \cdots) and (b) illustrates the use of \framebox, \colorbox, and \fcolorbox.

enter image description here

\usepackage{amsmath} % for "\framebox" macro
\usepackage{xcolor}  % for "\colorbox" and "\fcolorbox" macros
\item The sum $\displaystyle 3-\frac{3}{10}+\frac{3}{100}
      - \frac{3}{1000} + \dots + \frac{(-1)^k 3}{10^k} 
      + \dotsb$ is closest to:
\item $\dfrac{2}{e}$
\item $\framebox{e}$
\item \colorbox{yellow}{$e^2$}
\item $\fcolorbox{orange}{green}{2}$
  • 1
    Thanks this helped a lot! Feb 17 '20 at 22:31
  • Too bad colorbox does not wrap text and puts everything on one line instead. Jun 27 at 13:54

Hi Qais Karaki and Welcome to TeX-SE.

I'm guessing your want to highlight the content after the \itemthan the item itself.

If you want to highlight the number or mark in \item, please check TivV comment.

There some options to put a box around the content after \item, which are indeed just a variation to putting a box around any text.

A MWE follows

            \begin{tcolorbox}[width=145mm, halign=center, colframe=black, colback=white, boxsep=0mm, arc=3mm]
        \begin{tcolorbox}[width=145mm, halign=center, colframe=black, colback=yellow!80!black, boxsep=0mm, arc=3mm]
        Not to long text
        \begin{tcolorbox}[width=145mm, halign=center, colframe=blue, colback=red!80!white, boxsep=0mm, arc=0mm]
            \parbox{135mm}{ %

enter image description here

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.