## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Remove trailing Zeros in Axis Labels Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

### Remove trailing Zeros in Axis Labels

I've also asked this question on TeX StackExchange.

\documentclass{article}
\usepackage{pst-plot}

\begin{document}
\psset{xunit=2}
\begin{pspicture}(3,1)
\psaxes[Dx = 0.5]{->}(3,1)
\end{pspicture}
\end{document}

Is it possible to get "1" and "2" instead of "1.0" and "2.0" (as with 0) as axis labels?
In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

LaTeXguide.org • LaTeX-Cookbook.net

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

### Remove trailing Zeros in Axis Labels  Topic is solved

Here is a solution from Marco Daniel:

\documentclass{article}

\usepackage{pst-plot}

\makeatletter
\def\@LabelComma#1.#2.#3\@nil{%
\def\pst@tempA{#1}%
\ifx\pst@tempA\@empty\the\@zero\else#1\fi% the integer part
\def\pst@tempA{#2}
\ifx\pst@tempA\@empty
\@writeDecimals{}%
\else%
\ifnum#2=0\relax\else%
\@writeDecimals{#2}%
\fi%
\fi%
}
\makeatother

\begin{document}

\psset{xunit = 2}
\begin{pspicture}(3,1)
\psaxes[
comma,
Dx = 0.5
]{->}(3,1)
\end{pspicture}

\end{document}
In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)