I have used \footnotesize to scale labels before and it has produced the desired results. But am having problems when I pass this as part of the label to a macro. The following MWE compiles but not if I comment out the line that redefines \footnotesize.
If needed, further details of \ShowIntersection can be found in Intersections in PGFplots and GetListMember can be found in Macro to access a specific member of a list
\documentclass{standalone}
\usepackage{xstring}
\usepackage{pgfplots}
\usetikzlibrary{intersections}
\pgfkeys{/pgfplots/Linear Axis Style/.style={
clip=true,
minor tick num=0,
axis y line=center,
axis x line=middle,
x axis line style={name path global=XAxisLine},
y axis line style={name path global=YAxisLine}
}
}
\begin{document}
\newcommand*\GetListMember[2]{\StrBetween[#2,\number\numexpr#2+1]{,#1,},,}%
\newcommand*{\ShowIntersection}[3]{
\fill
[name intersections={of=#1 and #2, name=i, total=\t}]
[red, opacity=1, every node/.style={black, opacity=1}]
\foreach \s in {1,...,\t}{(i-\s) circle (2pt)
node [above left, blue] {\GetListMember{#3}{\s}}};
}
\begin{tikzpicture}
\begin{axis}[Linear Axis Style,
xmin=-1.5, xmax=1.51,% Need asymmetry here due to bug in PGFplots
ymin=-1, ymax=3,
]
\addplot[name path global=a, mark=none, domain=-2.5:2.5, thick] ({x},{x*x-0.5});%
\def\footnotesize{}% Why can I not comment this out?
\ShowIntersection{a}{XAxisLine}{{\footnotesize{$X_1$}},{$(A,B)$}}
\ShowIntersection{a}{YAxisLine}{{\footnotesize{$Y$}}}
\end{axis}
\end{tikzpicture}
\end{document}