ERG's MRS output as LaTeX

What’s current best way to obtain MRS representations from ERG in LaTeX? The ERG’s own function does not immediately work for me, either I am using it incorrectly (I am copying and pasting the output into my LaTeX document and include the mrs.sty package) or something in that code is outdated.

Is there something in delphinviz? The demo only offers an image, I think.

For my dissertation I used the output from the LKB to get the basic LaTeX commands, but I ended up tweaking the code myself and modifying mrs.sty to get it to look right. I think I added just the following to mrs.sty:

  \left \langle
      \left \{ {\begin{array}{l}#3\end{array}} \right \},\\
      \lbrace #4 \rbrace \\
  \right \rangle

Then here’s how I call it for the MRS for “Every dog chased some cat”:

  \ex \label{ex:edcsc-3b}
    \srole{ARG0}{\svar{x}{6}{\svp{PERS}{3}, \svp{NUM}{sg}, \svp{IND}{$+$}}},
    \srole{ARG0}{\svar{e}{3}{\svp{SF}{prop}, \svp{TENSE}{past}, \svp{MOOD}{indicative}, \svp{PROG}{$-$}, \svp{PERF}{$-$}}},\\
    \srole{ARG2}{\svar{x}{9}{\svp{PERS}{3}, \svp{NUM}{sg}, \svp{IND}{$+$}}}},\\
  {\sqeq{12}{13}, \sqeq{7}{8}, \sqeq{1}{2}}

delphinviz only offers an image in the Simple MRS pseudo-feature-structure visualization, not the indexed Simple MRS visualization that is produced by mrs.sty. I would like PyDelphin to have an mrs-latex conversion target like it has dmrs-tikz, but it does not currenly provide this. It would actually be fairly simple to implement, but I was hoping to also provide a replacement for mrs.sty, and this takes a bit more effort.

1 Like

I used the code below to output mrs into my emacs buffer when using the lkb. I can’t remember why I preferred this to LUI.

I think you can also save latex from LUI:


;;; Output latex in emacs

;;; turn on with (setf mrs-latex-output-p t)

(in-package :mrs)

(defvar mrs-latex-output-p nil)

(defun output-mrs-after-parse (&optional edges stream)

;;; for ACL this is most likely to be useful in an emacs window

;;; the need to use lkb-background-stream is because

;;; of the complexity with background streams in ACL

;;; it’s set in topmenu.lsp

(when (or mrs-scoping-output-p






(unless stream

(setf stream lkb::lkb-background-stream))

(unless edges (setf edges parse-record))

(let ((print-circle nil))

(loop for edge in edges


(let ((mrs (extract-mrs edge)))

(format stream “~%Edge number ~A”

(lkb::edge-id edge))

(format stream “~%~A~%”

(lkb::parse-tree-structure edge))

(treat-mrs mrs t stream))))))

(defun mrs::treat-mrs (mrs-struct simplep stream)

(format stream "~%~A " lkb::sentence)

(setf mrs-debug mrs-struct)

(when mrs-base-output-p

(output-mrs1 mrs-struct 'simple stream))

(when mrs-scoping-output-p

(process-mrs-struct mrs-struct nil 10 simplep stream))

(when mrs-fol-output-p

(output-fol-approximation mrs-struct stream))

(when rmrs-xml-output-p

(output-rmrs1 (mrs-to-rmrs mrs-struct) 'xml stream))

(when mrs-latex-output-p

(mrs::output-mrs1 mrs-struct 'mrs::latex stream))

(when rmrs-compact-output-p

(output-rmrs1 (mrs-to-rmrs mrs-struct) 'compact stream t))

(when mrs-discourse

 (output-mrs1 mrs-struct 'simple stream)

 (output-mrs1 mrs-struct 'prolog stream)

 (with-open-file (pro-out "~/tmp/prologformat"

		  :direction :output :if-does-not-exist :create

		  :if-exists :append)

   (output-mrs1 mrs-struct 'prolog pro-out))))
1 Like