6

i would like to replicate this box from a french physics book. I've tried mdframed, tcolorbox, fancybox packages without success.

May someone help me please?

enter image description here

this is waht i've tried so far: with fancy box:

\documentclass[10pt,a4paper]{book}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[top=1.5cm, bottom=1.5cm, outer=6.5cm, inner=1.5cm, heightrounded, marginparwidth=4cm, marginparsep=0.5cm]{geometry}

\usepackage{fancybox}

\begin{document}
    \newcommand{\application}[2]{\boxput *(-.7 ,1){
    \colorbox{white}{\bfseries{Application n°#1}}
    }{
    \setlength {\fboxsep }{10pt}
    \fbox {\begin{minipage}{17cm}
    #2
    \end{minipage}}
    }}
\end{document}

This box will contaain text and picture, and it would be nice if it brake at the en d of a page.

As you can see it only misses a thick horizontal line

enter image description here

  • 1
    It would help if you could show what you have tried. Also, do the boxes need to break across pages? Should they float, like figures and tables, or be part of the continuous document flow? The font of the heading looks rather unusual - how important is it to reproduce it exactly? – Michael Palmer Dec 16 '17 at 14:55
  • 1
    Do it with tcolorbox. That's the most powerfull package. – Ulrike Fischer Dec 16 '17 at 15:30
9

I have tried getting something from where you can work from, using tcolorbox.

Of course, I haven't matched your fonts... but that shouldn't be difficult

\documentclass[10pt]{article}
\usepackage{tikz}
\usepackage{tcolorbox}

\tcbuselibrary{skins}

\newtcolorbox{application}[2][]{%
    % [#1]: Extra options for the tcolorbox
    % {#2}: Title of box
    title= {#2},
    enhanced, 
    skin=enhancedlast,
    sharp corners,
    colframe = blue,
    colback = white,
    drop fuzzy shadow,
    boxrule = 0.41pt, %Width of line    
    borderline north={1.1mm}{-1.1mm}{black}, %The two distances must be equal magnitude but opposite in sign
    attach boxed title to top left={
        xshift = -2mm,
        yshift=-0.5mm,
        yshifttext=-1mm
    },
    coltitle = black!50!blue,
    fonttitle = \Large\itshape,
    boxed title style = {
        colframe = white,
        colback = white,
        sharp corners
    },#1
}


\begin{document}

\begin{application}{My application 1}
     hey

     it's me

     you are looking for

     \vspace{8cm}
\end{application}

\end{document}

You could get more fancy, using the auto counter option with My Application \thetcbcounter, but I am not sure if that is what you wanted, and it would only complicate the solution for not much added benefit

Solution

  • I'd guess the top line should be aligned with the text's baseline, not its descenders. Looks a bit weird that way. – Joey Dec 17 '17 at 11:32
  • @Joey you can adjust that with the yshift inside attach boxed title to top left and with the properties of the title box. Maybe yshift= -2.2mm might work as you want. Or using a frame.base. There are ways to tinker around the proposed solution, it is not set in stone – Alex Recuenco Dec 17 '17 at 11:42

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.