Seite 1 von 1

Zellenbedingte Formatierung, Einbindung von booktabs und

Verfasst: Mi 20. Apr 2016, 00:00
von die_nase
Hallo zusammen,

ich bin gerade dabei eine Tabelle mithilfe von pgfplotstable zu erstellen. Ich würde gerne eine bedingte Formatierung für die einzelnen Zellen (bzw. Spalten) vorgeben. In dem Manual stand folgende Lösung:
columns/account1/.style={fonts by sign={\color{green}}{\color{red}}}
Das gilt allerdings nur für positive und negative Werte. Wie kann ich eine Formatierung festlegen für z.B. alle Zellen einer Spalte, die <400 oder =100 sind?

Weiterhin würde ich gerne booktabs verwenden, also horizontale Linien.

Bisher habe ich folgenden Code:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{pgfcalendar}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.13}

\begin{filecontents}{accounts.dat} 
account1 account2 account3
60 1200 400
120 1600 -410
-10 1600 410
1800 -500 410
2300 500 410
800 -192 100
\end{filecontents} 

\begin{document}
\pgfplotstabletypeset[
columns={account1, account2, account3},
column type=r,
columns/account1/.style={fonts by sign={\color{green}}{\color{red}}}
]{accounts.dat}

\vspace{5cm}

\begin{tabular}{rrr} 
\toprule
account1 & account2 & account3\\ 
\midrule 
60 & 1200 & 400		\\
120 & 1600 & -410	\\
-10 & 1600 & 410 	\\
1800 & -500 & 410	\\
2300 & 500 & 410		\\
800 & -192 & 100 	\\
\bottomrule
\end{tabular}

\end{document}
Könnt ihr mir vielleicht helfen oder mir einen Hinweis geben?

Viele Grüße

Re: Zellenbedingte Formatierung, Einbindung von booktabs und

Verfasst: Mi 20. Apr 2016, 03:14
von Bartman
die_nase hat geschrieben:Weiterhin würde ich gerne booktabs verwenden, also horizontale Linien.
Abschnitt 2.1 auf Seite 4 der Dokumentation von pgfplotstable.
every head row/.style={before row=\toprule,after row=\midrule},
every last row/.style={after row=\bottomrule}

Verfasst: Mi 20. Apr 2016, 13:13
von die_nase
Hallo Bartman,

oh super, vielen Dank für deine Antwort!

Hat jemand noch einen Tipp bzgl. der bedingten Formatierung?

Verfasst: Fr 22. Apr 2016, 13:59
von die_nase
..oder kann mir jemand einen Tipp/Ansatz geben?

Verfasst: Sa 23. Apr 2016, 07:25
von Bartman

Verfasst: Sa 23. Apr 2016, 20:03
von die_nase
Danke! :)