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.

Hi all, I'm a newby in LaTeX but after researching online, I have seen that it is possible to create boxes and frames adjusted to text and images. I am trying to achieve something like the image, what would you recommend? I have seen you can use \ovalbox, mdframed, beamer, TiKZ… My main issue is framing the title in the position required and insert image. Thanks a lot! :)

share|improve this question
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  hpesoj626 Nov 18 '13 at 11:23

2 Answers 2

up vote 13 down vote accepted

with tcolorbox and tikz

\documentclass{article}
\usepackage{tikz}
    \usetikzlibrary{shadows}
\usepackage{tcolorbox}
    \tcbuselibrary{skins}

\definecolor{mygreen}{rgb}{0.61,0.73,0.35}


\newcommand{\mytitle}[1]{
    \node[fill=mygreen,
        rounded corners,
        draw=white,
        line width=2pt,
        drop shadow,
        text width=4cm,
        inner sep=8pt,
        xshift=-2cm]
    at (frame.north){\bfseries\textcolor{white}{#1}};
}

\newtcolorbox{mybox}[2][]{
    enhanced,
    overlay={\mytitle{#2}},
    borderline={2pt}{0mm}{mygreen},
    borderline={.7pt}{1mm}{mygreen},
    frame hidden,
    arc=3mm,
    sidebyside,
    lefthand width=2.5cm,
    segmentation hidden,
    top=15pt,
    #1
}

\begin{document}

\begin{mybox}{Political Factors}
    \includegraphics[scale=.1]{lion.jpg}
    \tcblower
    Analyses to what degree the government intervenes
\end{mybox}

\end{document}

enter image description here

The optional argument in the newtcolorbox is there in case you need to apply different customizations to specific boxes (e.g., you could have the same box with a different background color with \begin{mybox}[colback=red]{Political Factors}. It is ignored otherwise, as in the given MWE.

share|improve this answer
    
Woah! I have been playing around with these packages and it's amazing the things you can do with them. Thank you so much for your help. You have really provided me a head start for Latex use! :) Thanks thanks!! –  user41232 Nov 23 '13 at 18:05
    
@user41232 you're welcome, have fun with LaTeX :) –  dcmst Nov 23 '13 at 18:22

Here is a possible mdframed approach. I used the package mwe just so that the code will compile. I have made liberal use of the picture you provided for the image, though.

\documentclass{article}

\usepackage{mwe}
\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{shadows}

\definecolor{mygreen}{rgb}{0.61,0.73,0.35}

\mdfdefinestyle{mystyle}{%
    innerlinewidth = 0.5pt,
    outerlinewidth = 2pt,
    linecolor = mygreen,
    tikzsetting = {draw = white, line width = 0.5pt},
    roundcorner=15pt,
    linecolor=mygreen,
    linewidth=2pt,
    topline=true,
    frametitleaboveskip=1.5\dimexpr-\ht\strutbox\relax,
}

\newenvironment{definition}[1][]{%
\ifstrempty{#1}%
    {\mdfsetup{%
    style = mystyle,
    }}%
    {\mdfsetup{%
    style = mystyle,
    frametitle={%
    \tikz{[baseline=(current bounding box.east),outer sep=0pt]
    \node[draw = white, line width = 2pt, text = white, anchor=east,rectangle,
    fill=mygreen, rounded corners, drop shadow]
    {\strut #1};
    }}}}%
    \begin{mdframed}[]\relax%
}{\end{mdframed}}

\begin{document}
\begin{definition}[Political Factors]
\begin{minipage}{0.25\linewidth}
\includegraphics[width = \linewidth]{example-image-a}
\end{minipage}%
\hfill
\begin{minipage}{0.7\linewidth}
Analyses to what degree the government intervenes in the
economy. It includes regulations and legal issues and defines
both formal and informal rules under which the firm must
operate. Political factors include: tax policy, employment laws,
environmental regulations, trade restriction tariffs and political
stability.
\end{minipage}%
\end{definition}
\end{document}

enter image description here

share|improve this answer
    
Nice!! I'm now further investigating about the mwe package... really versatile! :) Thanks a lot for your help! –  user41232 Nov 23 '13 at 18:04

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.