How to avoid latches during synthesis
To avoid latches, you need to make sure all of your outputs are assigned at all possible branches of the code.

for example, 

if a = '1' then
   b(0) &lt;= '1';
else
   b(1 downto 0) &lt;= "00";
end if;


would generate a latch, because in the first condition, the value of b(1) is not specified, so the compiler decided you wanted to keep the previous value of b(1) there. One way to write this that would not generate a latch is:

if a = '1' then
   b &lt;= prev_b;
   b(0) &lt;= '1';
else
   b(1 downto 0) &lt;= "00";
end if;

...

if rising_edge (clk)
    prev_b &lt;= b;
end if;


Here you explicitly state that b should retain it's old value, and then overwrite b(0) with the new value.

Another way is to give b a default value, as in @TomiJ's answer.

If you post the code you are getting a latch on, we could help you find the specific reason.