The following problem occurs when the package documentation is started from TeXstudio.
But first to my configuration:
I'm using the portable version of MikTeX and the portable version of TeXstudio (Win7x64). Therefore the file types like .dvi, .ps etc. are not associated to any program on my system. This is a problem for texdoc, because it just opens the documentation, terminates and let the os handle the rest.
But as described in the manual it is possible to set some enviroment variables which point to the correct location of the viewer (e. g. MIKTEX_VIEW_dvi). If this is done, texdoc can also be used in a portable context, but with one difference: texdoc opens the package documentation and does not terminate.
The last part conflicts with TeXstudio, because it waits abour 2 seconds for the termination of texdoc and gives an error message otherwise (as far as I can see the relevant method is "void Help::viewTexdoc(QString package)"). Now I can open package documentation from TeXstudio and it opens correctly, but after 2 seconds I get the "texdoc took too long to open the documentation for the package:" error message (btw. if I don't set the enviroment variable at all and try to open the package documentation TeXstudio crashes on my system after showing me two error messages).
I would have two ideas to fix this:
I would prefer the second approach, because the user has just to make sure that the paths to the viewer are set correctly and then the rest works out of the box.
I hope this helps you and thanks for your work, you are great!
This is not so easy. texdoc appears to be quite inconsistent (both among different distributions (MikTeX / TeXlive) and also within MikTeX using different commands).
For example (using MikTeX):
--print-onlydoes not yield the same result as--view--list-onlyyields multiple documents. One cannot easily determine which one is the main documentation file.In contrast, TeXlive has another syntax, e.g.
texdoc --list -M xcolor(I'm not even sure if there is an equivalent to--print-only. Additionally the output format is different.To conclude
--viewdoes work independent of the distribution. Everything else would require a lot of case distinctions and we don't have the time to dig into this. You are welcome to investigate this in more detail. If you can come up with a general and not to complicated recipe how to get the command and/or the main documentation file from texdoc, we can implement it.The original issue (incorrect error message) is fixed by not waiting for texdoc to return if MikTeX is used and a MIKTEX_VIEW_* environment variable is set: hg 5146 (259c5a68459c)