Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: render latex below #347

Closed
2 tasks done
Humam-Hamdan opened this issue Feb 24, 2025 · 9 comments
Closed
2 tasks done

feature: render latex below #347

Humam-Hamdan opened this issue Feb 24, 2025 · 9 comments
Labels
enhancement New feature or request

Comments

@Humam-Hamdan
Copy link

Neovim version (nvim -v)

0.11.0-dev

Neovim distribution

N/A

Operating system

Ubuntu 24.04

Terminal emulator / GUI

Kitty

Describe the bug

i copied and pasted the sample for a .md latex file, however nothing rendered. when i run :checkhealth render-markdown i see in Treesitter that there is no latex parser.. however i have the texlive package installed...

Expected behavior

# Latex


$\sqrt{3x-1}+(1+x)^2$


$\sum \epsilon \subset \beta$


$$
f(x,y) = x + \sqrt{y} \\
f(x,y) = \sqrt{y} + \frac{x^2}{4y}
$$

> [!caution] Hi!
> This is a Test!

this should render a latex view. it does not.

Healthcheck output

==============================================================================
render-markdown:                     require("render-markdown.health").check()

render-markdown.nvim [version] ~
- OK plugin 8.0.6
- OK neovim >= 0.10

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [treesitter] ~
- OK markdown: parser installed
- OK markdown_inline: parser installed
- WARNING latex: parser not installed
  - ADVICE:
    - Disable LaTeX support to avoid this warning by setting { latex = { enabled = false } }
- OK markdown: highlight enabled

render-markdown.nvim [icons] ~
- OK using: mini.icons

render-markdown.nvim [executables] ~
- OK latex2text: installed

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- OK obsidian: not installed

Plugin configuration

{
    'MeanderingProgrammer/render-markdown.nvim',
    dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite
    -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
    -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
    ---@module 'render-markdown'
    ---@type render.md.UserConfig
    opts = {},
    config = function()
      require('render-markdown').setup {
        file_types = { 'markdown', 'quarto' },
        render_modes = { 'n', 'c', 't' },
        latex = {
          enabled = true,
          converter = 'latex2text',
          highlight = 'RenderMarkdownMath',
          top_pad = 0,
          bottom_pad = 0,
        },
      }
    end,
  },

Plugin error log

N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

No response

@Humam-Hamdan Humam-Hamdan added the bug Something isn't working label Feb 24, 2025
@Humam-Hamdan
Copy link
Author

was missing tree-sitter.

cargo install tree-sitter-cli

fixed it.

but the rendering is not right rn...

@Humam-Hamdan
Copy link
Author

in pure kitty it renders fine. with tmux nope.

@Humam-Hamdan
Copy link
Author

was a config.fish problem.

another question: can i make it so that the render appear below the text?

@Humam-Hamdan Humam-Hamdan changed the title bug: latex parser not installed ~~bug: latex parser not installed~~ how to change render place Feb 24, 2025
@Humam-Hamdan Humam-Hamdan changed the title ~~bug: latex parser not installed~~ how to change render place ~bug: latex parser not installed~ how to change render place Feb 24, 2025
@MeanderingProgrammer
Copy link
Owner

was missing tree-sitter.

This will depend on how you install neovim, since you're running 0.11 I assume you're building from source, in which case you'll need to make sure all the system dependencies are installed, like tree-sitter, luajit, etc.

From there you gotta get the latex parser installed, I thought you would need tree-sitter to install any additional ones, but maybe that's not the case?

In either case looks like you got that part figured out.

@MeanderingProgrammer
Copy link
Owner

in pure kitty it renders fine. with tmux nope.

I have no idea why tmux would cause an issue, testing on kitty, wezterm, and ghostty all 3 work with and without tmux so maybe a system specific thing or some tmux configuration setting.

Here's my config if that helps: https://github.com/MeanderingProgrammer/dotfiles/blob/main/.config/tmux/tmux.conf

@MeanderingProgrammer
Copy link
Owner

another question: can i make it so that the render appear below the text?

Not right now but I can add that as a feature

@MeanderingProgrammer MeanderingProgrammer changed the title ~bug: latex parser not installed~ how to change render place feature: render latex below Feb 24, 2025
@MeanderingProgrammer MeanderingProgrammer added enhancement New feature or request and removed bug Something isn't working labels Feb 24, 2025
@Humam-Hamdan
Copy link
Author

I have no idea why tmux would cause an issue, testing on kitty, wezterm, and ghostty all 3 work with and without tmux so maybe a system specific thing or some tmux configuration setting.

it was because i was forcing fish to get fastfetch everytime. an interactive-shell condition solved that

@Humam-Hamdan
Copy link
Author

Humam-Hamdan commented Feb 24, 2025

This will depend on how you install neovim, since you're running 0.11 I assume you're building from source, in which case you'll need to make sure all the system dependencies are installed, like tree-sitter, luajit, etc.

i get it from the ppa. but yep needed to install rust and get tree-sitter from cargo -since the one in the ubuntu repos is 0.20.8 which is just old.-

MeanderingProgrammer added a commit that referenced this issue Feb 25, 2025
## Details

Request: #347

Adds `position` option to `latex` configuration which supports 2 values,
`above` or `below`. The default value is set to `above` and results in
no change in behavior from before.

Setting it `below` will instead render the virtual lines below the block
but otherwise they are rendered in the same way.

```lua
require('render-markdown').setup({
    latex = { position = 'below' },
})
```
@MeanderingProgrammer
Copy link
Owner

Added this feature here: 43a971e

Can set it via:

require('render-markdown').setup({
    latex = { position = 'below' },
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants