(diagram, grid, morphisms,
                            morphisms_str_info, diagram_format)
return result
Given a collection of :class:`ArrowStringDescription`
        describing the morphisms of a diagram and the object layout
        information of a diagram, produces the final Xy-pic picture.
Given a collection of :class:`ArrowStringDescription`
        describing the morphisms of a diagram and the object layout
        information of a diagram, produces the final Xy-pic picture.
Given a collection of : class : ArrowStringDescription describing the morphisms of a diagram and the object layout information of a diagram produces the final Xy - pic picture .
def _build_xypic_string(diagram, grid, morphisms,
                            morphisms_str_info, diagram_format):
        """
        Given a collection of :class:`ArrowStringDescription`
        describing the morphisms of a diagram and the object layout
        information of a diagram, produces the final Xy-pic picture.
        """
        # Build the mapping between objects and morphisms which have
        # them as domains.
        object_morphisms = {}
        for obj in diagram.objects:
            object_morphisms[obj] = []
        for morphism in morphisms:
            object_morphisms[morphism.domain].append(morphism)

        result = "\\xymatrix%s{\n" % diagram_format

        for i in xrange(grid.height):
            for j in xrange(grid.width):
                obj = grid[i, j]
                if obj:
                    result += latex(obj) + " "

                    morphisms_to_draw = object_morphisms[obj]
                    for morphism in morphisms_to_draw:
                        result += str(morphisms_str_info[morphism]) + " "

                # Don't put the & after the last column.
                if j < grid.width - 1:
                    result += "& "

            # Don't put the line break after the last row.
            if i < grid.height - 1:
                result += "\\\\"
            result += "\n"

        result += "}\n"

        return result
def _build_xypic_string ( diagram , grid , morphisms , morphisms_str_info , diagram_format ) : # Build the mapping between objects and morphisms which have # them as domains. object_morphisms = { } for obj in diagram . objects : object_morphisms [ obj ] = [ ] for morphism in morphisms : object_morphisms [ morphism . domain ] . append ( morphism ) result = "\\xymatrix%s{\n" % diagram_format for i in xrange ( grid . height ) : for j in xrange ( grid . width ) : obj = grid [ i , j ] if obj : result += latex ( obj ) + " " morphisms_to_draw = object_morphisms [ obj ] for morphism in morphisms_to_draw : result += str ( morphisms_str_info [ morphism ] ) + " " # Don't put the & after the last column. if j < grid . width - 1 : result += "& " # Don't put the line break after the last row. if i < grid . height - 1 : result += "\\\\" result += "\n" result += "}\n" return result