In my document I've a side capture environment as well as a full width environment for figures and tables. In the past I all my documents were printed on the back and front of a page, thus I had a clause in the environment that checked if a page is odd or even.
Now I want to only print on one side of the page and thus the environment should check for that. How can I accomplish this? (I'm using scrbook).
\documentclass[a4paper, oneside]{scrbook}
...
\usepackage{realboxes}
\newenvironment{fwfigure}[1][htbp]%
{%
\begin{figure}[#1]
\checkoddpage
\edef\side{\ifoddpage l\else r\fi}% <<<--- Here should another if statement check the *side-mode
\Makebox[\textwidth][\side]\bgroup%
\begin{minipage}[t]{\textwidth+\marginparsep+\marginparwidth}
\centering
}{%
\end{minipage}%
\egroup%
\end{figure}
}
EDIT:
I ended up doing this:
\makeatletter
\if@twoside%
\newcommand{\side}{\ifoddpage l\else r\fi} %% twoside=true
\else%
\newcommand{\side}{l} %% twoside=false
\fi%
\makeatother
%%%
\usepackage{realboxes}
\newenvironment{fwfigure}[1][htbp]%
{%
\begin{figure}[#1]
\checkoddpage
\Makebox[\textwidth][\side]\bgroup%
\begin{minipage}[t]{\textwidth+\marginparsep+\marginparwidth}
\centering
}{%
\end{minipage}%
\egroup%
\end{figure}
}
typearea(loaded by all KOMA-Script classes) provides\if@semitwosideadditionally. So its possible to test if KOMA-Script optiontwoside=semiis set. – esdd Mar 28 '17 at 12:06