Farben umschalten mit OCGX - mehrere Schaltflächen

Farben umschalten mit OCGX - mehrere Schaltflächen

EDIT: Die erste Problembeschreibung war nicht gut genug, bitte beachten Sie die Bearbeitung am Ende.

HierIch habe gefragt, wie man mit OCGX die Farben umschaltet. Das war die Lösung:

\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}

Jetzt möchte ich zwei (oder mehr) Schaltflächen haben, die sich gegenseitig beeinflussen (d. h. wenn Schaltfläche1 rot und Schaltfläche2 grün ist und eine der Schaltflächen angeklickt wird, wird Schaltfläche1 grün und Schaltfläche2 blau; und das Gleiche gilt für jede andere Kombination). Ich weiß nicht, wie das gemacht werden kann, da Schaltfläche1 nicht „weiß“, welche Farbe Schaltfläche2 hat, wenn ich auf Schaltfläche1 klicke.

EDIT: Anscheinend habe ich mein Problem nicht gut genug beschrieben. Was ich möchte, sind (zum Beispiel) vier Schaltflächen, die in zwei Reihen und zwei Spalten angeordnet sind, so dass jede Schaltfläche sich selbst und die beiden Schaltflächen in derselben Reihe bzw. Spalte beeinflusst (d. h. eine Schaltfläche beeinflusst nicht alle anderen Schaltflächen). Das Hauptziel besteht darin, dies für eine beliebige Anzahl von Schaltflächen zu tun, die in einem Rechteck angeordnet sind.

Antwort1

Es sieht so aus, als würde jeder Knopf alle vier Farben durchlaufen (Rot, Grün, Blau, keine Farbe), aber die Farbe jedes Knopfs ist im Verhältnis zu seinem linken Nachbarn um eins verschoben.

Mit einem Klick auf eine beliebige Schaltfläche können Sie den Zyklus fortsetzen (Öffnen inTeilenLaTeX):

\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}

verwandte Informationen