Cook onion, garlic and rosemary in 1/3 cup water until onions are soft. Add beans, pasta, stock and tomato paste and bring to a boil (you may need to add water). Reduce heat and simmer for 30 minutes. Add salt and plenty of freshly ground black pepper to taste.