ashthespy / Atom-LaTeX

The only LaTeX package you need for typesetting with Atom.
https://atom.io/packages/atom-latex
MIT License
22 stars 9 forks source link

Root Path improvements #267

Closed mfbehrens99 closed 3 years ago

mfbehrens99 commented 3 years ago

image Slightly decreasing font-size

image Path is overflowing to the left when it is too long

ashthespy commented 3 years ago

Thanks for this! :-) Could you explain the rational behind 4ed3f97? If you set the rootpath, then the .latexcfg is kinda moot isn't it? Furthermore, since you find to root on start now..

What I have in my workflow is this simple script in init.coffee that sets the current open editor as the root in my .latexcfg

# Command to setup a new .latexcfg file

atom.commands.add 'atom-workspace',
  'atom-latex:init': () =>
    Fname = atom.workspace.getActiveTextEditor().getTitle() || 'main.tex'
    Fdir = atom.workspace.project.relativizePath(atom.workspace.getActiveTextEditor().getPath())[0] || atom.workspace.project.getPaths()[0]
    config =
      root: Fname
      toolchain: 'arara %DOC -v'
      latex_ext: [".tikz",".tex"]
    fs = require 'fs'
    fs.writeFile("#{Fdir}/.latexcfg",JSON.stringify(config, null, 4),\ # Indented JSON
      'utf8', (e) ->
        console.log e if e?
        console.log " .latexcfg created for #{Fname} in #{Fdir}"
        )
mfbehrens99 commented 3 years ago

I thought when the user is using the manual home function there is probably a problem with the automatic home file finder. So I decided that whenever somebody is changing the root path it should be saved for future sessions.

The init.coffee is possible too. I just think that it is just easier to load up the root file on startup automatically. Especially for starters. I can also add a button in the menu that can disable that functionality.