What I want to do is to use Figure, Table and Alternative Figure captions, placed on the left or the right side depending on whether the current page is odd or even.
Thanks to the great help of the user which answered my two questions floatrow: change caption position in odd and even pages and floatrow: change caption position in odd and even pages (continued) , the floatrow package was used in order to auto position the captions of Figure and Table objects.
I want to use a new object as well, which will contain a picture, but the caption name shall not be "Figure" but something else, let's call it "AlternativeFigure". Thus I created an infobox (see code below) which I try to use the same way I do with Figure and Table, but it doesn't seem to work that way.
Any thoughts would be appreciated.
\documentclass[12pt]{book}
\usepackage{lipsum}
\usepackage[demo]{graphicx}
\usepackage {atbegshi}
\usepackage[paperheight=24.0cm, paperwidth=20cm, top=1.75cm,bottom=2.0cm,left=2.0cm,right=6.0cm, headsep=0.25cm]{geometry}
\usepackage{floatrow}
\def\mypage{0}
\AtBeginShipout{\ifnum\mypage=0\relax\gdef\mypage{1}%
\else\gdef\mypage{0}\fi}
\expandafter\def\csname floatsetup0\endcsname{%
\floatsetup[widefigure]
{margins=hangright,capposition=beside,capbesideposition={top,right},
floatwidth=\textwidth}%
\floatsetup[table]
{margins=hangright,capposition=beside,capbesideposition={top,right},
floatwidth=\textwidth}}
\expandafter\def\csname floatsetup1\endcsname{%
\floatsetup[widefigure]
{margins=hangleft,capposition=beside,capbesideposition={top,left},
floatwidth=\textwidth}%
\floatsetup[table]
{margins=hangleft,capposition=beside,capbesideposition={top,left},
floatwidth=\textwidth}}
\newenvironment{altfig}[1][htbp]{\csname floatsetup\mypage\endcsname%
\begin{figure*}[#1]}{\end{figure*}}
\newenvironment{alttable}[1][htbp]{\csname floatsetup\mypage\endcsname%
\begin{table}[#1]}{\end{table}}
%-------------------------------
% INFOBOX
\usepackage{float}
\newfloat{infobox}{tbp}{ext}
\restylefloat*{infobox}
\floatname{infobox}{AlternativeFigure}
\newenvironment{altfigure}[1][htbp]{\csname floatsetup\mypage\endcsname%
\begin{infobox}[#1]}{\end{infobox}}
%-------------------------------
\begin{document}
\lipsum[66]
\begin{altfig}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is the first caption text}
\end{altfig}
\lipsum[66]
\begin{alttable}[htp]
\begin{tabular}{lll}
11 & 12 & 13\\
21 & 22 & 23\\
31 & 32 & 33\\
\end{tabular}
\caption{This is a table text}
\end{alttable}
\lipsum[66]
\begin{infobox}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is an alternative caption text (should be positioned in the right hand side)}
\end{infobox}
\lipsum[66]
\begin{altfig}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is the second caption text}
\end{altfig}
\lipsum[66]
\begin{alttable}[htp]
\begin{tabular}{lll}
11 & 12 & 13\\
21 & 22 & 23\\
31 & 32 & 33\\
\end{tabular}
\caption{This is a table text}
\end{alttable}
\lipsum[66]
\begin{infobox}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is an alternative caption text (should be positioned in the left hand side)}
\end{infobox}
\end{document}



floatrowpackage documentation says not to use it with thefloatpackage, which you do here in your MWE. Here are the first words of the abstract: "This package was created as extension of the float package. The floatrow package borrows core code from the float 1 and rotfloat 2 packages, so you must not load these packages." See Section 4.1 How to replace\newfloatwith\DeclareNewFloatType– Steven B. Segletes May 23 '17 at 15:06floatrowpackage and try to create the three objects (Figure, Table and AlternativeFigure) with caption texts as illustrated above, or should I give a try to thefloatpackage instead? – user3060854 May 23 '17 at 15:14