5

For my poster I am using the tikzfigure environment within tikzposter to add figures. It works fine, but I want to have the figure captions justified or left aligned instead of centered.

I have tried \justify or \begin{flushleft} ... \end{flushleft} within the caption, changing the tikzposter class file but it does not work.

MWE:

\documentclass[25pt, a0paper, landscape, margin=0mm, innermargin=50mm,
 blockverticalspace=15mm, colspace=30mm, subcolspace=8mm]{tikzposter} 
\geometry{paperwidth=100cm,paperheight=197cm} 
\makeatletter
\setlength{\TP@visibletextwidth}{\textwidth-2\TP@innermargin}
\setlength{\TP@visibletextheight}{\textheight-2\TP@innermargin}
\makeatother
\tikzposterlatexaffectionproofon 
% Commands
\newcommand{\bs}{\textbackslash}   
\newcommand{\cmd}[1]{{\bf \color{red}#1}}   
\usetheme{Simple}
\usebackgroundstyle{Empty}

\begin{document}

    \maketitle

 \begin{columns}%blocks will be placed into columns

                \column{.5}
                    \block{someblock1}{
                     \begin{tikzfigure}[\justify CAPTION HERE]
                     \includegraphics[width=0.40\colwidth] {images/someimage1.pdf}
                     \end{tikzfigure}      
            }

                \column{.5}
                    \block{someblock2}{
                    \begin{flushleft}
                    \begin{tikzfigure}[CAPTION HERE]
                    \includegraphics[width=0.40\colwidth] {images/someimage2.pdf}
                    \end{tikzfigure} 
                    \end{flushleft}
            }

 \end{columns}

 \end{document}

Thanks!

  • Would you mind to include some Minimal Working Example to play with. Please from \documentclass to \end{document} and including all packages related with your problem. It will be easy to help you. Thanks. – Ignasi Apr 10 '15 at 9:22
  • My apologies. I have added a MWE. – jon86 Apr 10 '15 at 9:51
4

First version:

Put this in your preamble. Here the caption is aligned to the left starting with the figure:

\renewenvironment{tikzfigure}[1][]{
  \def \rememberparameter{#1}
  \vspace{10pt}
  \refstepcounter{figurecounter}
  \begin{center}
  \tabular{l}
  }{
    \ifx\rememberparameter\@empty
    \else %nothing
    \\[10pt]
    {\small Fig.~\thefigurecounter: \rememberparameter }
    \fi
  \endtabular
  \end{center}
}

enter image description here

Second version:

Here the caption is aligned totally to the left.

\renewenvironment{tikzfigure}[1][]{
  \def \rememberparameter{#1}
  \vspace{10pt}
  \refstepcounter{figurecounter}
  \begin{center}
  }{
    \ifx\rememberparameter\@empty
    \else %nothing
    \\[10pt]
    {\small Fig.~\thefigurecounter: \rememberparameter \hfill \mbox{}}
    \fi
  \end{center}
}

enter image description here

Code:

\documentclass[25pt, a0paper, landscape, margin=0mm, innermargin=50mm,
 blockverticalspace=15mm, colspace=30mm, subcolspace=8mm]{tikzposter}
\geometry{paperwidth=100cm,paperheight=197cm}
\makeatletter
\setlength{\TP@visibletextwidth}{\textwidth-2\TP@innermargin}
\setlength{\TP@visibletextheight}{\textheight-2\TP@innermargin}
\makeatother
\tikzposterlatexaffectionproofon
% Commands
\newcommand{\bs}{\textbackslash}
\newcommand{\cmd}[1]{{\bf \color{red}#1}}
\usetheme{Simple}
\usebackgroundstyle{Empty}

%\renewenvironment{tikzfigure}[1][]{
%  \def \rememberparameter{#1}
%  \vspace{10pt}
%  \refstepcounter{figurecounter}
%  \begin{center}
%  \tabular{l}
%  }{
%    \ifx\rememberparameter\@empty
%    \else %nothing
%    \\[10pt]
%    {\small Fig.~\thefigurecounter: \rememberparameter }
%    \fi
%  \endtabular
%  \end{center}
%}

\renewenvironment{tikzfigure}[1][]{
  \def \rememberparameter{#1}
  \vspace{10pt}
  \refstepcounter{figurecounter}
  \begin{center}
  }{
    \ifx\rememberparameter\@empty
    \else %nothing
    \\[10pt]
    {\small Fig.~\thefigurecounter: \rememberparameter \hfill \mbox{}}
    \fi
  \end{center}
}

\begin{document}

    \maketitle

 \begin{columns}%blocks will be placed into columns

                \column{.5}
                    \block{someblock1}{
                     \begin{tikzfigure}[CAPTION HERE]
                     \includegraphics[width=0.40\colwidth] {example-image}
                     \end{tikzfigure}
            }

                \column{.5}
                    \block{someblock2}{
                    \begin{flushleft}
                    \begin{tikzfigure}[CAPTION HERE]
                    \includegraphics[width=0.40\colwidth] {example-image}
                    \end{tikzfigure}
                    \end{flushleft}
            }

 \end{columns}

 \end{document}

If you want to do it on per figure basis you may use a \parbox

\documentclass[25pt, a0paper, landscape, margin=0mm, innermargin=50mm,
 blockverticalspace=15mm, colspace=30mm, subcolspace=8mm]{tikzposter}
\geometry{paperwidth=100cm,paperheight=197cm}
\makeatletter
\setlength{\TP@visibletextwidth}{\textwidth-2\TP@innermargin}
\setlength{\TP@visibletextheight}{\textheight-2\TP@innermargin}
\makeatother
\tikzposterlatexaffectionproofon
% Commands
\newcommand{\bs}{\textbackslash}
\newcommand{\cmd}[1]{{\bf \color{red}#1}}
\usetheme{Simple}
\usebackgroundstyle{Empty}


\begin{document}

    \maketitle

 \begin{columns}%blocks will be placed into columns

                \column{.5}
                    \block{someblock1}{
                     \begin{tikzfigure}[{\parbox[t]{0.39\colwidth}{CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE }}]
                     \includegraphics[width=0.40\colwidth] {example-image}
                     \end{tikzfigure}
            }

                \column{.5}
                    \block{someblock2}{
                    \begin{flushleft}
                    \begin{tikzfigure}[CAPTION HERE]
                    \includegraphics[width=0.40\colwidth] {example-image}
                    \end{tikzfigure}
                    \end{flushleft}
            }

 \end{columns}

 \end{document}

enter image description here

Please note that an extra pair of braces is needed surroung the \parbox in

\begin{tikzfigure}[{\parbox[t]{0.39\colwidth}{CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE }}]
  • Thanks!But now I the lines don't break according to the column end. How do I fix that? – jon86 Apr 10 '15 at 10:36
  • @jon86 In which version do you want the modification for breaking lines? – user11232 Apr 10 '15 at 10:38
  • Kumar. The first version. Is it maybe also possible to do this for each caption seperately? – jon86 Apr 10 '15 at 11:19
  • @jon86 Instead of l column, use p column with a width equal to the width of the figure (here 0.4\colwidth. You have to do it manually). – user11232 Apr 10 '15 at 13:27
  • 1
    @jon86 line break and per figure basis added now. – user11232 Apr 10 '15 at 13:35

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.