2

I'm doing a beamer presentation and for this I'm using a background image on each slide. To have a readable text I put it on a untitled block with background transparency (cf image).

One of my slide

My problem is the overlap between the block's header and the block's body : as you can see, together, the element's transparency is lower because this overlap.

I think I've two solution :

  1. reduce the height of the block's header
  2. extend the space between header and body's block

But I don't know how to do this. Can someone explain me how to do this properly ? Or may be existing an other (and simpler) solution…

Thank you

Here is my code :

\documentclass{beamer}

\usepackage{beamerbasethemes}
\usepackage{calc}
\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[no-math]{fontspec}
\usepackage{ragged2e}
\usepackage{graphics}
\usepackage[frenchb]{babel}
\usepackage{nicefrac}
\usepackage{xcolor}
\usepackage{calc}
\usepackage{tikz}

% link to the backgroundimage
% image should be in the same directory as the other files
\def\blackboard@backgroundimagefile{bg.jpg}
\DeclareOptionBeamer{backgroundimagefile}{\def\blackboard@backgroundimagefile{#1}}
\ProcessOptionsBeamer

\mode<presentation>

\pgfdeclareimage[interpolate=true, height=\the\paperheight, width=\the\paperwidth]{backgroundImage}{\blackboard@backgroundimagefile}

% stretch background image over the entire page
\setbeamertemplate{background}{
    \begin{tikzpicture}
        \useasboundingbox (0,0) rectangle (\the\paperwidth, \the\paperheight); 
        \pgftext[at=\pgfpoint{0cm}{0cm}, left, base]{\pgfuseimage{backgroundImage}}; 
    \end{tikzpicture}
}

\setbeamertemplate{blocks}[rounded][shadow=false]
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.75}}{\pgfsetfillopacity{1}}

\begin{document}

    \begin{frame}{Projet}{Axe 1 : Petite enfance et découverte}
        \begin{block}{}
            \begin{itemize}
                \item A deux ans, 90\% de psychomotricité globale et 10\% de jeux et d'activités sur surface élastique
                \item A 3 ans, 80\% de psychomotricité globale et 20\% de jeux et d'activités sur surface élastique
                \item A 4 ans, 65\%  de psychomotricité globale et 35\% d'activités sur surface rebondissante
                \item A 5 ans, 50\% de psychomotricité globale et 50\% d'éducation aérienne.
            \end{itemize}
            \vfill
            En introduisant ainsi les surfaces élastiques, cela nous permettrait également une détection précoce des talents et aptitudes des enfants, pouvant alors à les orienter vers des disciplines plus appropriées une fois l’âge venu.
        \end{block}
    \end{frame}
\end{document}
2
  • Welcome to TeX.Stackexchange! Can you make a compilable MWE which does not rely on your custom theme, which we do not have? It's hard to guess a solution, when we can not test it. Jul 1 '16 at 13:42
  • MWE added (testing on Mac OS X 10.11.5, MacTex 2015). Just need to add a JPG file named "bg.jpg".
    – Gregg
    Jul 3 '16 at 15:18
1

The "problem" is that the title area and the body overlap a bit. I added the line

                \advance\bmb@dima by0.95pt%NEW

to the definition of the rounded blocks. You might have to experiment a bit to finetune this value.

\documentclass{beamer}

\usepackage{beamerbasethemes}
\usepackage{calc}
\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage[no-math]{fontspec}
\usepackage{ragged2e}
\usepackage{graphics}
\usepackage[frenchb]{babel}
\usepackage{nicefrac}
\usepackage{xcolor}
\usepackage{calc}
\usepackage{tikz}

% link to the backgroundimage
% image should be in the same directory as the other files
\def\blackboard@backgroundimagefile{bg.jpg}
\DeclareOptionBeamer{backgroundimagefile}{\def\blackboard@backgroundimagefile{#1}}
\ProcessOptionsBeamer

\mode<presentation>

\pgfdeclareimage[interpolate=true, height=\the\paperheight, width=\the\paperwidth]{backgroundImage}{\blackboard@backgroundimagefile}

% stretch background image over the entire page
\setbeamertemplate{background}{
    \begin{tikzpicture}
    \useasboundingbox (0,0) rectangle (\the\paperwidth, \the\paperheight); 
    \pgftext[at=\pgfpoint{0cm}{0cm}, left, base]{\pgfuseimage{backgroundImage}}; 
    \end{tikzpicture}
}

\makeatletter
\renewcommand\beamerboxesrounded[2][]{%
    \pgfsetfillopacity{0.75}
    \global\let\beamer@firstlineitemizeunskip=\relax%
    \vbox\bgroup%
    \setkeys{beamerboxes}{upper=block title,lower=block body,width=\textwidth,shadow=false}%
    \setkeys{beamerboxes}{#1}%
    {%
        \usebeamercolor{\bmb@lower}%
        \globalcolorstrue%
        \colorlet{lower.bg}{bg}%
    }%
    {%
        \usebeamercolor{\bmb@upper}%
        \globalcolorstrue%
        \colorlet{upper.bg}{bg}%
    }%
    %
    % Typeset head
    %
    \vskip4bp
    \setbox\bmb@box=\hbox{%
        \begin{minipage}[b]{\bmb@width}%
            \usebeamercolor[fg]{\bmb@upper}%
            #2%
        \end{minipage}}%
        \ifdim\wd\bmb@box=0pt%
        \setbox\bmb@box=\hbox{}%
        \ht\bmb@box=1.5pt%
        \bmb@prevheight=-4.5pt%
        \else%
        \wd\bmb@box=\bmb@width%
        \bmb@temp=\dp\bmb@box%
        \ifdim\bmb@temp<1.5pt%
        \bmb@temp=1.5pt%
        \fi%
        \setbox\bmb@box=\hbox{\raise\bmb@temp\hbox{\box\bmb@box}}%
        \dp\bmb@box=0pt%
        \bmb@prevheight=\ht\bmb@box%
        \fi%
        \bmb@temp=\bmb@width%
        \bmb@dima=\bmb@temp\advance\bmb@dima by2.2bp%
        \bmb@dimb=\bmb@temp\advance\bmb@dimb by4bp%
        \hbox{%
            \begin{pgfpicture}{0bp}{+-\ht\bmb@box}{0bp}{+-\ht\bmb@box}
                \ifdim\wd\bmb@box=0pt%
                \color{lower.bg}%
                \else%
                \color{upper.bg}%
                \fi%
                %               \pgfsetfillopacity{\opacitylevel}%NEW
                \pgfpathqmoveto{-4bp}{-1bp}
                \pgfpathqcurveto{-4bp}{1.2bp}{-2.2bp}{3bp}{0bp}{3bp}
                \pgfpathlineto{\pgfpoint{\bmb@temp}{3bp}}
                \pgfpathcurveto%
                {\pgfpoint{\bmb@dima}{3bp}}%
                {\pgfpoint{\bmb@dimb}{1.2bp}}%
                {\pgfpoint{\bmb@dimb}{-1bp}}%
                \bmb@dima=-\ht\bmb@box%
                \advance\bmb@dima by0.95pt%NEW
                \pgfpathlineto{\pgfpoint{\bmb@dimb}{\bmb@dima}}
                \pgfpathlineto{\pgfpoint{-4bp}{\bmb@dima}}
                \pgfusepath{fill}
            \end{pgfpicture}%
            \copy\bmb@box%
        }%
        \nointerlineskip%
        \vskip-1pt%
        \ifdim\wd\bmb@box=0pt%
        \else%
        \hbox{%
            \begin{pgfpicture}{0pt}{0pt}{\bmb@width}{6pt}
                \bmb@dima=\bmb@width%
                \advance\bmb@dima by8bp%
                \pgfpathrectangle{\pgfpoint{-4bp}{-1bp}}{\pgfpoint{\bmb@dima}{8bp}}
                \pgfusepath{clip}
                {\pgftransformshift{\pgfpoint{-4bp}{0bp}}\pgftext[left,base]{\pgfuseshading{bmb@transition}}}%
            \end{pgfpicture}%
        }%
        \nointerlineskip%
        \vskip-0.5pt%
        \fi%
        \ifbmb@shadow%
        \setbox\bmb@boxshadow=\hbox{\pgfuseshading{bmb@shadow}}%
        \setbox\bmb@boxshadowball=\hbox{\pgfuseshading{bmb@shadowball}}%
        \setbox\bmb@boxshadowballlarge=\hbox{\pgfuseshading{bmb@shadowballlarge}}%
        \fi%
        \setbox\bmb@colorbox=\hbox{{\pgfpicturetrue\pgfsetcolor{lower.bg}}}%
        \setbox\bmb@box=\hbox\bgroup\begin{minipage}[b]{\bmb@width}%
            \vskip2pt%
            \usebeamercolor[fg]{\bmb@lower}%
            \colorlet{beamerstructure}{upper.bg}%
            \colorlet{structure}{upper.bg}%
            %\color{.}%
        }
\makeatother


\setbeamertemplate{blocks}[rounded][shadow=false]
%\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.75}}{\pgfsetfillopacity{1}}


\begin{document}

    \begin{frame}{Projet}{Axe 1 : Petite enfance et découverte}
        \begin{block}{}
            \begin{itemize}
                \item A deux ans, 90\% de psychomotricité globale et 10\% de jeux et d'activités sur surface élastique
                \item A 3 ans, 80\% de psychomotricité globale et 20\% de jeux et d'activités sur surface élastique
                \item A 4 ans, 65\%  de psychomotricité globale et 35\% d'activités sur surface rebondissante
                \item A 5 ans, 50\% de psychomotricité globale et 50\% d'éducation aérienne.
            \end{itemize}
            \vfill
            En introduisant ainsi les surfaces élastiques, cela nous permettrait également une détection précoce des talents et aptitudes des enfants, pouvant alors à les orienter vers des disciplines plus appropriées une fois l’âge venu.
        \end{block}
    \end{frame}
\end{document}

enter image description here

0

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.