This procedure finds the tags that have posts associated with them, and assembles a list based on the first letter:
$list = '';
$tags = get_terms( 'post_tag' );
$groups = array();
if( $tags && is_array( $tags ) ) {
foreach( $tags as $tag ) {
$first_letter = strtoupper( $tag->name[0] );
$groups[ $first_letter ][] = $tag;
}
if( !empty( $groups ) ) {
foreach( $groups as $letter => $tags ) {
$list .= "\n\t" . '<h2>' . apply_filters( 'the_title', $letter ) . '</h2>';
$list .= "\n\t" . '<ul>';
foreach( $tags as $tag ) {
$url = attribute_escape( get_tag_link( $tag->term_id ) );
$count = intval( $tag->count );
$name = apply_filters( 'the_title', $tag->name );
$list .= "\n\t\t" . '<li><a href="' . $url . '">' . $name . '</a> (' . $count . ')</li>';
}
$list .= "\n\t" . '</li>';
}
}
}else $list .= "\n\t" . '<p>Nenhuma Tag foi encontrada</p>';
From there, it is at your discretion how to call the method, or even if you want to use this process in that way. In the middle of the code there are a lot of things that can be reduced, but the idea is basically this. Just give a print ($list)
that you have access to everything.