2

how can i set 2 tcbposter in only one page? and set their absolute position (x,y) for each tcbposter?

Minimal coding

\documentclass{article}

\usepackage{tcolorbox}
\tcbuselibrary{poster}
\usepackage{tikz}

\usepackage{lipsum}

\begin{document}

\begin{tcbposter}[
  poster = {
    columns=1,
    rows=2,
    spacing=3mm,
    height=14cm,
    width=6cm,
  },
  ]
  \posterbox[
  colframe = red,
  width=5cm, height= 10cm
  ]{ }{\includegraphics[width=3cm]{example-image-a}}

\end{tcbposter}

\begin{tcbposter}[
  poster = {
    columns=1,
    rows=2,
    spacing=3mm,
    height=14cm,
    width=6cm,
  },
  ]
  \posterbox[
  colframe = blue,
  width=5cm, height= 10cm
  ]{ }{\includegraphics[width=3cm]{example-image-b}}

\end{tcbposter}

\end{document}

Thank in advance

latexforti
  • 2,091

1 Answers1

3

1. To place two posters on the same page:

Just do not leave a blank line between the two posters.

Indead, with TeX and LaTeX an empty line is interpreted as a new paragraph. So, the two posters are placed in two successive paragraphs.

screenshot

\documentclass{article}

\usepackage{tcolorbox}
\tcbuselibrary{poster}
\usepackage{tikz}

\usepackage{lipsum}

\begin{document}

\begin{tcbposter}[
  poster = {
    columns=2,
    rows=2,
    spacing=3mm,
    height=14cm,
    width=6cm,
  },
  ]
  \posterbox[
  colframe = red,
  width=5cm, height= 10cm
  ]{ }{\includegraphics[width=3cm]{example-image-a}}

\end{tcbposter}% <- delete blank ligne
\begin{tcbposter}[
  poster = {
    columns=1,
    rows=2,
    spacing=3mm,
    height=14cm,
    width=6cm,
  },
  ]
  \posterbox[
  colframe = blue,
  width=5cm, height= 10cm
  ]{ }{\includegraphics[width=3cm]{example-image-b}}

\end{tcbposter}

\end{document}

2. My proposal to place the two posters:

Instead of placing two posters side by side, I propose to place only one of them, which is the size of the entire page where the top, bottom, left and right margins are removed.

coverage = {spread,left=0pt,right=0pt,top=0pt,bottom=0pt},

And we position within it, the two boxes that you wanted to place. The first with {xshift=1cm,yshift=-2cm }, the second with {xshift=7cm,yshift=-5cm }

screenshot

\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage[poster]{tcolorbox}
\pagestyle{empty}
\begin{document}

\begin{tcbposter}[
coverage = {spread,left=0pt,right=0pt,top=0pt,bottom=0pt},
  poster = {showframe,
    columns=1,
    rows=1,
    rowspacing=0pt,
    colspacing=0pt,
  },
  ]
  \posterbox[
  colframe = red,
  width=5cm, height= 10cm
  ]{xshift=1cm,yshift=-2cm }{\includegraphics[width=3cm]{example-image-a}}

  \posterbox[
  colframe = blue,
  width=5cm, height= 10cm
  ]{xshift=7cm,yshift=-5cm }{\includegraphics[width=3cm]{example-image-b}}
\end{tcbposter}

\end{document}

3. With the textpos package

I didn't want to use the Tikz parameters that allow you to place a box precisely in a page because it requires you to compile twice, which is a problem especially if your document is complex.

I use another package (textpos) that allows to place text in an absolute position on a page, which LaTeX does not normally allow because it is designed to manage box spacing for us.

Here is the code of the final result:

\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage[poster]{tcolorbox}
\usepackage[absolute%,showboxes
]{textpos}
\setlength{\TPHorizModule}{1cm}
\setlength{\TPVertModule}{1cm}

\pagestyle{empty}
\begin{document}
\begin{textblock}{6}(1,2)
\begin{tcbposter}[
coverage = {left=0pt,right=0pt,top=0pt,bottom=0pt},
  poster = {
    columns=1,
    rows=2,
    spacing=3mm,
    height=14cm,
    width=6cm,
  },
  ]
  \posterbox[
  colframe = red,
  width=5cm, height= 10cm
  ]{ }{\includegraphics[width=3cm]{example-image-a}}

\end{tcbposter}

\end{textblock}
\begin{textblock}{6}(7,5)
\begin{tcbposter}[
coverage = {left=0pt,right=0pt,top=0pt,bottom=0pt},
  poster = {
    columns=1,
    rows=2,
    spacing=3mm,
    height=14cm,
    width=6cm,
  },
  ]
  \posterbox[
  colframe = blue,
  width=5cm, height= 10cm
  ]{ }{\includegraphics[width=3cm]{example-image-b}}

\end{tcbposter}
\end{textblock}

\end{document}

Translated with www.DeepL.com/Translator

AndréC
  • 24,137