You can use the execute at begin axis
key to sneak another \pgfplotsset
command into the axis
options. This \pgfplotsset
command will be executed after the other axis
options have been set:
\documentclass[12pt,a4paper,tikz]{standalone} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage{tikz,pgfplots,grffile,amsmath} \pgfplotsset{compat=newest} \pgfplotsset{ mytikzstyle/.style={ every axis/.append style={ execute at begin axis={ \pgfplotsset{ legend style={ font=\tiny }, every x tick label/.append style={font=\scriptsize}, every y tick label/.append style={font=\scriptsize} } } } } } \pgfplotsset{mytikzstyle} \pgfplotsset{/pgfplots/width=8cm} \pgfplotsset{/pgfplots/height=6cm} \begin{document} \begin{tikzpicture} \begin{axis}[% separate axis lines, every x tick label/.append style={font=\color{black}}, legend style={at={(0.99,0.01)}, anchor=south east, legend cell align=left, align=left, draw=gray}, ] \addplot [line width=0.8pt, color=black] table[row sep=crcr]{% 1 1\\ 100 100\\ }; \addlegendentry{Hello $U_{1}\frac{xyz}{xyz}$} \end{axis} \end{tikzpicture}% \end{document}