0

I'm using mdframed to create a box around two lines of text so that I can insert a colored left border. Here's my MWE:

\documentclass{book}

\usepackage{mdframed}

\newmdenv[topline=false,rightline=false,bottomline=false,linewidth=2pt]{leftbot}
\setlength{\parindent}{0pt}
\setlength{\parskip}{15pt}


\newcommand{\leftborder}[1]{
    \begin{leftbot}
        {
            \fontsize{11pt}{0pt}
            \selectfont
            \MakeUppercase{Use Cases}
            \par
        }
        { % Title
            \fontsize{25pt}{25pt}
            \selectfont
            \textbf{#1}
        }
    \end{leftbot}
}

\begin{document}
    \leftborder{Internet of Things}
\end{document}

The result is actually not bad at all:

enter image description here

But it's slightly different from what I want:

enter image description here

Nevermind the line color and the font, I already managed those two. The problem is how the text is aligned with respect to the border. In my version, the text appears to be vertically centered, but the design version is aligned to the bottom. How can I do that?

2
  • Please note that your \fontsize{25pt}{25pt} is not really well chosen, nor is \fontsize{11pt}{0pt}
    – user31729
    Jan 19, 2018 at 20:41
  • I know, but this is never supposed to span multiple lines, this actually came from design. Jan 21, 2018 at 0:40

1 Answer 1

2

Change innerbottommargin to 0pt or even a negative value, say, 1ex. 0pt will place the descdender of g on the bottom line.

\documentclass{book}

\usepackage{mdframed}

\newmdenv[topline=false,innerbottommargin=-1ex,rightline=false,bottomline=false,linewidth=2pt]{leftbot}
\setlength{\parindent}{0pt}
\setlength{\parskip}{15pt}


\newcommand{\leftborder}[1]{
    \begin{leftbot}
        {
            \fontsize{11pt}{0pt}
            \selectfont
            \MakeUppercase{Use Cases}
            \par
        }
        { % Title
            \fontsize{25pt}{25pt}
            \selectfont
            \textbf{#1}
        }
    \end{leftbot}
}

\begin{document}
    \leftborder{Internet of Things}
\end{document}
5
  • 1
    +1 always for the you excellent answer. Is it arrived my upvpte?
    – Sebastiano
    Jan 19, 2018 at 20:37
  • @Christian, this does work for the text "Internet of Things", but the space between the two lines grew instead of bringing "USE CASES" down as well. Would you know a fix for that? Jan 19, 2018 at 21:06
  • (Although, I might just ask the designer if this is OK. But that will have to wait until Monday...) Jan 19, 2018 at 21:07
  • @AndréFratelli: mdframed offers innertopmargin as option as well.
    – user31729
    Jan 19, 2018 at 21:24
  • @ChristianHupfer great, I'll give it a go! Jan 22, 2018 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .