# Question:How do align in printf ?

## Question:How do align in printf ?

Maple 18

v1:=[
eta[p2] = 0.260 ,
eta[p3] = 0.113 ,
eta[p4] = -0.013 ,
eta[p5] = 0.215 ,
eta[p6] = -0.189 ,
eta[phi2] = 0.020 ,
eta[phi3] = 0.063 ,
eta[phi4] = -0.014 ,
eta[phi5] = -0.414 ,
eta[phi6] = 0.067 ,
mu[p] = 0.466 ,
mu[phi] = -0.169 ,
tau[p3] = -0.000 ,
tau[p4] = 0.000 ,
w[1] = 0.023 ,
w[2] = -0.447 ,
w[3] = -0.110 ,
w[4] = 0.035 ,
w[5] = 0.445
]:

for i to numelems(v1) do
printf("%a = %3.3f , \n",lhs(v1[i]),rhs(v1[i]));
end do:

This runs and returns:

eta[p2] = 0.260 ,
eta[p3] = 0.113 ,
eta[p4] = -0.013 ,
eta[p5] = 0.215 ,
eta[p6] = -0.189 ,
eta[phi2] = 0.020 ,
eta[phi3] = 0.063 ,
eta[phi4] = -0.014 ,
eta[phi5] = -0.414 ,
eta[phi6] = 0.067 ,
mu[p] = 0.466 ,
mu[phi] = -0.169 ,
tau[p3] = 0.000 ,
tau[p4] = 0.000 ,
w[1] = 0.023 ,
w[2] = -0.447 ,
w[3] = -0.110 ,
w[4] = 0.035 ,
w[5] = 0.445 ,

Is there a way to align the qual signs? also to align the decials like this:

eta[p2]   =  0.260 ,
eta[p3]   =  0.113 ,
eta[p4]   = -0.013 ,
eta[p5]   =  0.215 ,
eta[p6]   = -0.189 ,
eta[phi2] =  0.020 ,
eta[phi3] =  0.063 ,
eta[phi4] = -0.014 ,
eta[phi5] = -0.414 ,
eta[phi6] =  0.067 ,
mu[p]     =  0.466 ,
mu[phi]   = -0.169 ,
tau[p3]   =   0.000 ,
tau[p4]   =   0.000 ,
w[1]       =   0.023 ,
w[2]       = -0.447 ,
w[3]       = -0.110 ,
w[4]       =  0.035 ,
w[5]       =  0.445 ,

For the negative numbers, I prefer to have 1 space of indentation.

Thanks,

casper

﻿