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

Neorg render-latex fails to position equations when there are other images in the file #1352

Open
2 tasks done
jonboh opened this issue Mar 26, 2024 · 3 comments
Open
2 tasks done
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@jonboh
Copy link

jonboh commented Mar 26, 2024

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

NVIM v0.10.0-dev-00e71d3 Build type: Release LuaJIT 2.1.1693350652 Run "nvim -V1 -v" for more info

Neorg setup

require('neorg').setup({["load"] = {["core.concealer"] = { },["core.defaults"] = { },["core.dirman"] = {["config"] = {["workspaces"] = {["vault"] = "~/doc/vault"}}},["core.export"] = { },["core.export.markdown"] = { },["core.integrations.image"] = { },["core.integrations.telescope"] = { },["core.integrations.treesitter"] = { },["core.keybinds"] = {["config"] = {["hook"] = function(keybinds)
  --keybinds.unmap('norg', 'n', '<C-s>')

  keybinds.map(
    'norg',
    'n',
    '<localleader>o',
    ':Neorg return<CR>',
    {silent=true}
  )
  keybinds.map(
    'norg',
    'n',
    '<localleader>c',
    ':Neorg toggle-concealer<CR>',
    {silent=true}
  )
  keybinds.map(
    'norg',
    'n',
    '<localleader>f',
    ':Telescope neorg find_norg_files<CR>',
    {silent=true}
  )
  keybinds.map(
    'norg',
    'n',
    '<localleader>s',
    ':Telescope neorg find_linkable<CR>',
    {silent=true}
  )
  keybinds.map(
    'norg',
    'n',
    '<localleader>lf',
    ':Telescope neorg insert_file_link<CR>',
    {silent=true}
  )
  keybinds.map(
    'norg',
    'n',
    '<localleader>ls',
    ':Telescope neorg insert_link<CR>',
    {silent=true}
  )
end
}},["core.latex.renderer"] = { }}})

I use nixvim to configure my neovim, you could run my flake directly to reproduce my editor and test the bug if you are familiar with nix: https://github.com/jonboh/nixvim/tree/21c034b3dacac692848265092f27cae986a24367

Actual behavior

If there are no other images in the document the equations are shown correctly:
image

However, if there are other images, it seems that the location of the equations does not take
into account the displacement that the images will generate:
image

Expected behavior

Equations should be positioned in the same line that their source.

Steps to reproduce

Open a file with a content similar to this (you can use any image):

* Test

  first equation:  $\min_\theta \mathbb{E} -\log p_\theta(x)$
  .image ./isomorphism.png






  some extra text

  second equation: $\min_\theta \mathbb{E} -\log p_\theta(x)$


Potentially conflicting plugins

No response

Other information

No response

Help

None

Implementation help

No response

@jonboh jonboh added the bug Issues related to bugs. Please attach a severity, a priority and category with this label. label Mar 26, 2024
@jonboh
Copy link
Author

jonboh commented Mar 27, 2024

It seems that the problem is only present when the conceal option in core.latex.renderer is set to true:
image

@benlubas
Copy link
Contributor

I can look into this

@benlubas
Copy link
Contributor

The difference is with_virtual_padding vs not. With it, image.nvim controls and updates the position of the image, without it, we have to do it manually, and the code to do that isn't the most robust, it doesn't account for virtual lines above it for example. Which is what causes this issue.

I kinda want to implement this in image.nvim rather than here, so that other people can use this (it will also be easier to just reuse code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.
Projects
None yet
Development

No branches or pull requests

2 participants