Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I can make my xticklabel apply \bfseries, I can make my xlabel and ylabel apply \bfseries. For some reason, I cannot seem to get my yticklabel to apply this effect. At least when I compare the "1" in my xticklabel, it is clearly different than that in my yticklabel.

Fairly related, but happy to split into a 2nd question, is applying the same bold weight to the every node near coord/.append style. I do believe that these values are generated in mathmode, so I am not surprised I was not successful in applying a standard \bfseries weight to them. But if someone could provide a solution to that as well, it would be great. I did try, based on zero understanding of the inner workings, to use the etoolbox package and \robustify\bfseries without effect.

\documentclass[letterpaper]{article}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{xcolor}
\pagecolor{black}
\usepackage{siunitx}
%This didn't work either
%\usepackage{etoolbox}
%\robustify\bfseries
\sisetup{inter-unit-product={}\cdot{},sticky-per=true,multi-part-units=single,%
separate-uncertainty=true,list-units=single,range-units=single,detect-all,%
detect-weight=true,detect-inline-weight=math}

\DeclareSIUnit\calorie{cal}
\DeclareSIUnit\kcal{\kilo\calorie}
\DeclareSIUnit\kcalpmole{kcal\per\mole}

\definecolor{hoyemagenta}{HTML}{FF3FFF}
\definecolor{hoyegreen}{HTML}{31FF31}
%\usepgfplotslibrary{external}
%\tikzexternalize[shell escape=-enable-write18]
%\tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error %
%-interaction=batchmode -jobname "\image" "\texsource" && dvips -o "\image".ps %
%"\image".dvi}}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        color=white,
        width=450pt,
        ybar, bar shift=0pt, bar width=12,
        enlarge x limits=0.07,
        ylabel={Free Energy Difference (\si{\kcalpmole})},
        xlabel={Trapping Product},
        label style={color=white,font=\bfseries},
        xtick={1,2,3,4,5,6,7,8,9,10,11,12},
        every axis/.style={color=white},
        ymax=40,
        ymin=-110,
%       I also tried manually setting the ticks, in hopes that would trigger the change        
%       ytick={-100,-80,-60,-40,-20,0,20,40},
        xtick pos=left,
        nodes near coords,
        %Here I tried setting \bfseries for my nodes without success
        every node near coord/.append style={font=\bfseries,%
        /pgf/number format/.cd,
        fixed,
        fixed zerofill,
        precision=2},
        nodes near coords align={vertical},
        tick label style={font=\bfseries\Large},       
%        y tick label style={color=white,font=\bfseries},
%       I used to just have this x tick label style line below, then I tried the separate y tick label style
%       and also the tick label style above that
%        x tick label style={anchor=center,yshift=-6pt,color=white,font=\bfseries\large},
        symbolic x coords={1,2,3,4,5,6,7,8,9,10,11,12}
        ]
        \addplot[fill=hoyegreen,]
        coordinates{
        (1,-48.93)
        (3,-13.62)
        (6,-46.85)
        (8,-42.27)
        (10,-55.74)};
        \addplot[fill=hoyemagenta]
        coordinates{        
        (2,-26.90)
        (4,31.78)
        (5,-49.25)
        (7,-49.71)
        (9,-44.14)
        (11,-51.07)};
        \addplot[fill=yellow]
        coordinates{(12,-97.69)};
    \end{axis}
\end{tikzpicture}
\end{document}
share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Using \boldmath instead of \bfseries is sufficient for both questions.

enter image description here

I would really consider changing the style but it's a matter of taste.

share|improve this answer
    
Can you explain what you would design differently? I do have some requirements, black background and white text are a must. Everything else is pretty much open to changing. Also, is there a way to get the text size of the ylabel to match that of the xlabel? They should look exactly the same font style/size, etc. –  J M Sep 10 '12 at 3:40
    
@JM Then nevermind. Those are the ones that I had in mind but if so, there is not much to do. They look pretty much the same to me. –  percusse Sep 10 '12 at 3:40
    
Yea, it is for a presentation, and the whole template we use are black background, white text. It has the benefit that when we spot color portions of a slide, colors really pop against the black background. –  J M Sep 10 '12 at 3:42
    
@JM There is a nice chapter in beamer manual about this dark background issue ;) –  percusse Sep 10 '12 at 3:43
    
:) Yea, I do understand some of those (like the difficulty reading, hence the need for bold text). But this is a standard requirement I must have. Any help on that size issue in my first comment? Can I force "textmode" –  J M Sep 10 '12 at 3:52
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.