Alternar colores con ocgx - múltiples botones

Alternar colores con ocgx - múltiples botones

EDITAR: La primera descripción del problema no fue lo suficientemente buena; tenga en cuenta la edición al final.

AquíPregunté cómo alternar colores con ocgx. Esta fue la solución:

\documentclass{beamer}
\usepackage{xcolor}
\usepackage{ocgx2}

\begin{document}
\begin{frame}
  \makebox[0pt][l]{%
    \begin{ocg}{Bul01r}{ocg01r}{1}\actionsocg{ocg01r ocg01g}{}{}{\textcolor{red}{\textbullet}}\end{ocg}%
  }%
  \makebox[0pt][l]{%
    \begin{ocg}{Bul01g}{ocg01g}{0}\actionsocg{ocg01g ocg01b}{}{}{\textcolor{green}{\textbullet}}\end{ocg}%
  }%
  \makebox[0pt][l]{%
    \begin{ocg}{Bul01b}{ocg01b}{0}\actionsocg{ocg01b ocg01x}{}{}{\textcolor{blue}{\textbullet}}\end{ocg}%
  }%
  \begin{ocg}{Bul01x}{ocg01x}{0}\actionsocg{ocg01x ocg01r}{}{}{$\circ$}\end{ocg}%
\end{frame}
\end{document}

Ahora quiero tener dos (o más) botones de modo que se influyan entre sí (es decir, si el Botón1 es rojo y el Botón2 es verde y se hace clic en uno de los botones, el Botón1 se vuelve verde y el Botón2 se vuelve azul; y lo mismo para cualquier otra combinación). No veo cómo se puede hacer esto, ya que el Botón1 no "sabe" qué color tiene el Botón2 cuando hago clic en el Botón1.

EDITAR: Parece que no describí mi problema lo suficientemente bien. Lo que quiero son (por ejemplo) cuatro botones dispuestos en 2 filas y 2 columnas de modo que cada botón influya en sí mismo y en los dos botones de la misma fila respectivamente. misma columna (es decir, un botón no influye en todos los demás botones). El objetivo principal es hacer esto para un número arbitrario de botones dispuestos en un rectángulo.

Respuesta1

Parece que cada botón pasa por los cuatro colores (rojo, verde, azul, sin color), pero el color de cada botón cambia uno con respecto a su vecino izquierdo.

Se puede hacer clic en cualquier botón para avanzar en el ciclo (Abrir enCompartirLaTeX):

\documentclass{beamer}
\usepackage{xcolor}
\usepackage{ocgx2}
\usepackage{multido}

\begin{document}

\begin{frame}
  \multido{}{8}{
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 1st button
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 1}{state1}{1}\showocg{state2}{\textcolor{red}{\textbullet}}\end{ocg}%
    }%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 2}{state2}{0}\showocg{state3}{\textcolor{green}{\textbullet}}\end{ocg}%
    }%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 3}{state3}{0}\showocg{state4}{\textcolor{blue}{\textbullet}}\end{ocg}%
    }%
    \begin{ocg}[radiobtngrp=myBullets]{state 4}{state4}{0}\showocg{state1}{$\circ$}\end{ocg}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 2nd button
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 4}{state4}{0}\showocg{state1}{\textcolor{red}{\textbullet}}\end{ocg}%
    }%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 1}{state1}{1}\showocg{state2}{\textcolor{green}{\textbullet}}\end{ocg}%
    }%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 2}{state2}{0}\showocg{state3}{\textcolor{blue}{\textbullet}}\end{ocg}%
    }%
    \begin{ocg}[radiobtngrp=myBullets]{state 3}{state3}{0}\showocg{state4}{$\circ$}\end{ocg}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 3rd button
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 3}{state3}{0}\showocg{state4}{\textcolor{red}{\textbullet}}\end{ocg}%
    }%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 4}{state4}{0}\showocg{state1}{\textcolor{green}{\textbullet}}\end{ocg}%
    }%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 1}{state1}{1}\showocg{state2}{\textcolor{blue}{\textbullet}}\end{ocg}%
    }%
    \begin{ocg}[radiobtngrp=myBullets]{state 2}{state2}{0}\showocg{state3}{$\circ$}\end{ocg}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 4th button
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 2}{state2}{0}\showocg{state3}{\textcolor{red}{\textbullet}}\end{ocg}%
    }%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 3}{state3}{0}\showocg{state4}{\textcolor{green}{\textbullet}}\end{ocg}%
    }%
    \makebox[0pt][l]{%
      \begin{ocg}[radiobtngrp=myBullets]{state 4}{state4}{0}\showocg{state1}{\textcolor{blue}{\textbullet}}\end{ocg}%
    }%
    \begin{ocg}[radiobtngrp=myBullets]{state 1}{state1}{1}\showocg{state2}{$\circ$}\end{ocg}
  }
\end{frame}
\end{document}

información relacionada