aerial.nvim icon indicating copy to clipboard operation
aerial.nvim copied to clipboard

LaTeX

Open ignamartinoli opened this issue 1 year ago • 4 comments

Language: LaTeX

I read a bit about the symbolKind documentation but I really couldn't make out anything significant of it. LaTeX is a typesetting language, so the implementation should be similar to Markdown's one. It also allows for function definition, figures, tables, etc, but to at least being able to navigate smoothly between sections it would be really nice

ignamartinoli avatar Aug 11 '22 05:08 ignamartinoli

This is doable (though I probably can't get to it for a few weeks). Could you provide a minimal sample of some of the constructs that you would expect to show up in the symbol view? Ideally something like the existing test files.

stevearc avatar Aug 11 '22 06:08 stevearc

Hey, no problem. I looked into the Markdown file. If I guess correctly from what I read, the construct

# Title 1

is mapped to Interface.

LaTeX in that sense is similar: using as example a template for a document, it would be typesetted as:

\documentclass{article}

\usepackage{amsmath, color}

\newcommand*{\abs}[1]{\left|#1\right|}

\title{Lorem Ipsum}
\author{John Doe}
\date{01/01/1970}

\begin{document}

\maketitle
\newpage

\section{First section}

This is a section.

\subsection{A subsection}

This is a subsection.

\section{This is another subsection}

\end{document}

You can see that structurally, it has a lot of similarities with HTML.

After declaring the document class (<!DOCTYPE html>), you have a section for setupping (<head></head>) which can also have importing via the usepackage function and declaring user-defined command (this may be marked as a function symbol at the top of aerial tree).

After that you have the beginning of the document (<body></body>) that can be subdivided in sections just like on Markdown with up to three levels of nesting (subsubsection).

Right now the only plugin I know that correctly does this functionality for LaTeX is vimtex, which is actually pretty good, but it's too monolithic and doesn't use treesitter.

ignamartinoli avatar Aug 11 '22 16:08 ignamartinoli

Awesome, thanks for the sample! I'm going off grid for about a week, but I'll pick this up as soon as I'm able.

stevearc avatar Aug 15 '22 18:08 stevearc

Yea no rush, I'm also full with studies. Thanks for your time and the awesome plugin :D

ignamartinoli avatar Aug 15 '22 18:08 ignamartinoli

Apologies for the long silence; I usually use my email inbox as a todo list so I don't lose track of items, but somehow this one slipped away from me. I've added some basic latex symbols in treesitter. Give it a spin and please file follow up issues for any structures missing

stevearc avatar Oct 29 '22 22:10 stevearc

Thanks! I'll open another issue if I see any problems

ignamartinoli avatar Oct 29 '22 22:10 ignamartinoli