Entries field: Output entries related to category I have an entries field (activityPicker) that links to other entries in a different section. These other entries have categories (things-to-do and things-to-eat), and I'm trying to figure out how to filter these entries by categories.

My first instinct was to do something similar to this:

{# Categories #}
{% set CatToDo = craft.categories.slug('things-to-do') %}
{% set CatToEat = craft.categories.slug('things-to-eat') %}

{# Entries #}    
{% set toDo = entry.activityPicker.relatedTo(catToDo) %}
{% set toEat = entry.activityPicker.relatedTo(catToEat) %}

{# Output #}
{% for item in toDo %}
   {{ item }}
{% endfor %}

{% for item in toEat %}
   {{ item }}
{% endfor %}


however that didn't work so I tried playing with targetElement and sourceElement in the relatedTo parameter:

{% set toEat = entry.activityPicker.relatedTo({
   targetElement: catToEat
}) %}

[...]


but this still doesn't work. Basically I get that entry.activityPicker returns an array of posts, but I haven't figured out how to filter those posts in a meaningful way before they hit the template.
The targetElement and sourceElement take either an ID, an Element Model, or an array of either.

So, in your example, you'd want to do:

{# Categories #}
{% set CatToDo = craft.categories.slug('things-to-do').first %}
{% set CatToEat = craft.categories.slug('things-to-eat').first %}

{% set toEat = craft.entries.section('yourSection').relatedTo({
   targetElement: CatToEat,
   field: 'activityPicker'
}) %}

[...]


Notice the .first in there as the difference. You will only want the one category since you're passing the slug.

Note: This assumes that CatToEat is indeed the targetElement. See here for more information: http://buildwithcraft.com/docs/relations#the-relatedTo-param