30 在windows系统上将TL2025安装在WSL后如何使用命令texdoc.exe?

发布于 2025-03-10 13:02:02

如题:

本人OS信息:

物理机 windows10 pro 22H2 操作系统内部版本19045.5487
基于WSL2 下载了Ubuntu22.04

并且按照install-latex-guide-zh-cn的有关配置设置环境变量后,可以在WSL内正常使用tex -v:

explorer@DESKTOP-Explorer:/mnt/c/Users/Explorer$ tex -v
TeX 3.141592653 (TeX Live 2025)
kpathsea version 6.4.1
Copyright 2025 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.

同时在WSL的终端下使用texdoc -help可以弹出以下的内容:

explorer@DESKTOP-Explorer:/mnt/c/Users/Explorer$ texdoc -h
Usage: texdoc [OPTION]... NAME...
   or: texdoc [OPTION]... ACTION

Try to find appropriate TeX documentation for the specified NAME(s).
Alternatively, perform the given ACTION and exit.

Options:
  -w, --view        Use view mode: start a viewer. (default)
  -m, --mixed       Use mixed mode (view or list).
  -l, --list        Use list mode: show a list of results.
  -s, --showall     Use showall mode: show also "bad" results.

  -i, --interact    Use interactive menus. (default)
  -I, --nointeract  Use plain lists, no interaction required.
  -M, --machine     Machine-readable output for lists (implies -I).

  -q, --quiet       Suppress warnings and most error messages.
  -v, --verbose     Print additional information (e.g., viewer command).
  -D, --debug       Activate all debug output (equal to "--debug=all").
  -d LIST, --debug=LIST
                    Activate debug output restricted to LIST.
  -c NAME=VALUE     Set configuration item NAME to VALUE.
下略...

但是在WSL的终端使用texdoc lshort却似乎因为没有图形化界面设置默认打开pdf的软件,在等待大约30s之后,弹出:

texdoc warning: No viewer defined for ".pdf" files, using "viewer_txt" instead.

我又尝试了在windows的终端使用wsl.exe texdoc lshort,却提示:

master> wsl texdoc lshort
/bin/bash: line 1: texdoc: command not found

我不太理解的是,我是否应该把上述的环境变量不止写入.profile(如下图),同时也应该写入.bashrc呢?这里的$PATH,.profile以及.bashrcbash终端调用的先后逻辑是什么?

image.png

或者换句话说,我只希望将“编译”这件事移到WSL内,“查看文档、编辑代码”都希望在物理机windows内进行,是否有比较完善的方案呢?

另附~/.profile的文件内容:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
# TeXLive2025 environment config
export PATH=/usr/local/texlive/2025/bin/x86_64-linux:$PATH
export MANPATH=/usr/local/texlive/2025/texmf-dist/doc/man:$MANPATH
export INFOPATH=/usr/local/texlive/2025/texmf-dist/doc/info:$INFOPATH

查看更多

关注者
0
被浏览
71
其实有点卡
其实有点卡 8小时前
这家伙很懒,什么也没写!

手册 4.4 小节的方法没有效果吗?

1 个回答

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览