Latex-workshop: Texdoc command?

Created on 13 May 2018  ·  27Comments  ·  Source: James-Yu/LaTeX-Workshop

Description

I often use texdoc to read documentation of latex package. Would you mind to add a command to invoke texdoc, or accept a pull request that adds this command?

enhancement

Most helpful comment

It's simple. I don't read them.
Because I am a LaTeX n00b. No kidding 😭

All 27 comments

I personally have no experience with texdoc. Though PR is always welcomed, and can definitely get merged if it is beyond the interest of one or two people.

I'll take a look then. Just being curious: If you don't use texdoc, what do you use to read documentation of packages then?

It's simple. I don't read them.
Because I am a LaTeX n00b. No kidding 😭

I directly run texdoc packagename from the Terminal.
What do you exactly have in mind? To show the pdf documentation file in a new tab using the built-in pdf viewer?

@James-Yu 😄 Reminds me of when I started with latex: I didn't even _know_ that documentation about LaTeX existed until someone showed me texdoc 🙈

@jlelong Nothing special, to be honest. So far I also just run texdoc from the built-in terminal, but thought a dedicated command I could assign a keyboard shortcut would be more convenient. I'd start with the simplest approach first, and just add a command that prompts for a package name and calls texdoc with it. Other suggestions?

That could be an approach, but I have the feeling the gain is very little.
You could also imagine that when the cursor is on a package name inside a usepackage command, you could open its documentation. It involves navigating to the preamble of your root file.

I would rather prefer to start with the simplest approach first 🤷‍♂️ We can extend the command later, if needed.

How about using Ctrl + click on the package name? That's how TeXStudio allows me to access package documentation.

There is a package in atom to do it : https://github.com/Aerijo/hyperclick-latex it does the same as texstudio apparently.

But I am pretty sure it is way easier to implement it than linking bibtex references. I wish I was able to do a PR...

Thanks for the pointer. I will have a look at it.

Seems not possible to provide a command in definition provider, see definition.ts L16.

Hovering on a package inside \usepackage{....} brings up a tooltip with a command link to open the package documentation. It internally calls texdoc. Set latex-workshop.texdoc.path if texdoc is not in your path.

@jlelong doesn't work on windows

[error] "file" argument must be a non-empty string: TypeError: "file" argument must be a non-empty string
    at normalizeSpawnArguments (child_process.js:395:11)
    at Object.exports.spawn (child_process.js:508:38)

this error appears when I click open documentation

Can you put a break point inside in src/commander.ts line 554 and tell me if it comes from the package name being empty? It might be that texdoc is not in the path. Could you try calling texdoc from the command line?

@jlelong texdoc is in the path and I checked again, this works for other packages. I cant remember what package it didn't work for. Maybe it package name was empty?

I am very much interested in the package raising the error and the \usepackage command (any specific options?).

@jlelong haven't checked your latest commit but I just found textcomp is a package that raises errors

What does calling texdoc textcomp from the command line return?

Documentation for textcomp could not be found.

Maybe latex workshop could emit a notification that documentation wasn't found?

On OS X with Texlive, texdoc never returns an error code even if no documentation is found, so it hard to debug.

Are you using MikTeX? What is the output of the command?

texdoc --view textcomp || echo "--No doc found--"

@jlelong It still printed Documentation for textcomp could not be found.

And what is the output texdoc --version?
I have the impression that your version of texdoc returns an error code when the documentation is not found.

texdoc: warning: running with administrator privileges
MiKTeX Help Utility 2.9.6797 (MiKTeX 2.9.6800 64-bit)
Copyright (C) 2004-2017 Christian Schenk
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@Astrantia can you test my last commit?

@jlelong unfortunately it still doesn't work

[16:09:50] Opening documentation for textcomp.
[16:10:09] Opening documentation for textcomp.
[16:10:09] Opening documentation for textcomp.
[16:10:09] Opening documentation for textcomp.
[16:10:10] Opening documentation for textcomp.
[16:10:10] Opening documentation for textcomp.
[16:10:10] Opening documentation for textcomp.
[16:10:10] Opening documentation for textcomp.

tried clicking several times and no notification showed up. It doesn't say that it couldn't open in logs too.

@Astrantia new attempt...

@jlelong it works now!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iainmstott picture iainmstott  ·  5Comments

LordScree picture LordScree  ·  5Comments

tillahoffmann picture tillahoffmann  ·  6Comments

TiemenSch picture TiemenSch  ·  6Comments

wstcegg picture wstcegg  ·  5Comments