Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm working with package smartdiagram. Since I can't specify the width of the diagram (or can I...?), I'm using \resizebox as a workaround. This strategy works fine EXCEPT when I set custom colors (\setcolorbox...). How does trying to change the color cause all this strange behavior (see the image), and what can I do to fix it?

MWE:

smartdiagram example

\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{smartdiagram}

\begin{document}

\begin{figure}
\centering
\resizebox{.5\linewidth}{!}{%
\smartdiagramset{
bubble node size =3.5cm, 
bubble center node font = \small,
bubble node font = \tiny, 
distance center/other bubbles = 1cm, 
}
\smartdiagram[bubble diagram]{Traffic Flow\\ Problem,Neuroscience,Computer\\Science,Economics,Mathematics,Engineering, Physics}
}%end resizebox
\end{figure}

\begin{figure}
\centering
\resizebox{.5\linewidth}{!}{%
\smartdiagramset{
bubble node size =3.5cm, 
bubble center node font = \small,
bubble node font = \tiny, 
distance center/other bubbles = 1cm, 
set color list = {red!60, yellow!60, orange!60, green!60, purple!60, cyan!60}
}
\smartdiagram[bubble diagram]{Traffic Flow\\ Problem,Neuroscience,Computer\\Science,Economics,Mathematics,Engineering, Physics}
}%end resizebox
\end{figure}

\end{document}
share|improve this question

1 Answer 1

There are quite a few unwanted white spaces by line ends in both the MWE and package smartdiagram.

Sometimes it helps, if the line ends are disabled, which can be achieved by \endlinechar=-1. However some packages break (e.g.,tikz), thus the example loads the package that are required by smartdiagram beforehand.

Also some line ends in the MWE are commented and \box is inserted to show the bounding box for the graphics.

\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}

% packages loaded by "smartdiagram"
\RequirePackage{tikz}
\RequirePackage{etoolbox}
\RequirePackage{xparse}
\RequirePackage{xstring}
\usetikzlibrary{backgrounds,
   calc,
   fadings,
   shadows,
   shapes.arrows,
   shapes.symbols
}
\edef\RestoreEndlinechar{%
  \endlinechar=\the\endlinechar\relax
}
\endlinechar=-1
\usepackage{smartdiagram}
\RestoreEndlinechar

\begin{document}

\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}

\begin{figure}
  \centering
  \fbox{%
    \resizebox{.5\linewidth}{!}{%
      \smartdiagramset{
        bubble node size =3.5cm, 
        bubble center node font = \small,
        bubble node font = \tiny, 
        distance center/other bubbles = 1cm, 
      }%
      \smartdiagram[bubble diagram]{%
        Traffic Flow\\Problem,
        Neuroscience,
        Computer\\Science,
        Economics,
        Mathematics,
        Engineering,
        Physics%
      }%
    }% end resizebox
  }% end \fbox
\end{figure}

\begin{figure}
  \centering
  \fbox{%
    \resizebox{.5\linewidth}{!}{%
      \smartdiagramset{
        bubble node size =3.5cm, 
        bubble center node font = \small,
        bubble node font = \tiny, 
        distance center/other bubbles = 1cm, 
        set color list = {red!60, yellow!60, orange!60, green!60, purple!60,
            cyan!60}
      }%
      \smartdiagram[bubble diagram]{%
        Traffic Flow\\Problem,
        Neuroscience,
        Computer\\Science,
        Economics,
        Mathematics,
        Engineering,
        Physics%
      }%
    }% end resizebox
  }%end \fbox
\end{figure}

\end{document}

Result

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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