LaTeX缺少onimage.sty 安装的全过程

LaTex

提示:pdfLaTex 缺少 onimage.sty
使用命令: latex dtx 文件
生成sty到当前目录就好
也可以复制到latex的目录运行 texhash


提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档


下载dtx文件

提示:LaTeX Cookbook 这本书 :

下载链接: onimage.dtx


提示:以下是本篇文章正文内容,下面案例可供参考

一、LaTeX install onimage.sty

这个文章是解决安装sty文件的问题的,LaTeX。

二、使用步骤

1.生成sty

在当前目录执行:这个输出很多

(t18) mac@MacdeMacBook-Pro 4.0_Working_with_Images % ls onimage.dtx 
onimage.dtx
(t18) mac@MacdeMacBook-Pro 4.0_Working_with_Images % latex onimage.dtx 
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./onimage.dtx
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-02-24>
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/docstrip.tex

2.读入数据

这里还有整理目录的命令:

5163  ls /usr/local/texlive/2022/bin/universal-darwin/latex
 5164  ls /usr/local/texlive/2022/bin/universal-darwin/
 5165  ls /usr/local/texlive/2022/bin/
 5166  ls /usr/local/texlive/2022/
 5167  ls /usr/local/texlive/
 5168  ls /usr/local/texlive/2022/tlpkg
 5169  ls /usr/local/texlive/2022/bin/universal-darwin
 5170  texhash --help
 5171  cd 4.0_Working_with_Images
 5172  ls onimage.dtx
 5173  latex onimage.dtx
 5174  du -sh
 5175  ls onimage.sty
 5176  ls onimage.*
 5177  mkdir ../onimage
 5178  mv onimage.* ../onimage
 5179  ls
 5180  mv ../onimage .
 5181  ls
 5182  ls onimage
 5183  ls /usr/local/texlive/2022/texmf-dist/tex/latex/graphics/
 5184  texhash --help
 5185  cp onimage /usr/local/texlive/2022/texmf-dist/tex/latex/ -a
 5186  sudo cp onimage /usr/local/texlive/2022/texmf-dist/tex/latex/ -a
 5187  texhash
 5188  sudo texhash
 5189  texhash --help
 5190  texhash --dry-run
 5191  history 1|tail 50

把目录复制到LaTeX sty 路径

(t18) mac@MacdeMacBook-Pro 4.0_Working_with_Images % cp onimage /usr/local/texlive/2022/texmf-dist/tex/latex/ -a
cp: cannot create directory '/usr/local/texlive/2022/texmf-dist/tex/latex/onimage': Permission denied
(t18) mac@MacdeMacBook-Pro 4.0_Working_with_Images % sudo cp onimage /usr/local/texlive/2022/texmf-dist/tex/latex/ -a
Password:
(t18) mac@MacdeMacBook-Pro 4.0_Working_with_Images % texhash 
texhash: /usr/local/texlive/2022/texmf-config: directory not writable. Skipping...
texhash: /usr/local/texlive/2022/texmf-dist: directory not writable. Skipping...
texhash: /usr/local/texlive/2022/texmf-var: directory not writable. Skipping...
texhash: /usr/local/texlive/texmf-local: directory not writable. Skipping...
texhash: Done.
(t18) mac@MacdeMacBook-Pro 4.0_Working_with_Images % sudo texhash
texhash: Updating /usr/local/texlive/2022/texmf-config/ls-R... 
texhash: Updating /usr/local/texlive/2022/texmf-dist/ls-R... 
texhash: Updating /usr/local/texlive/2022/texmf-var/ls-R... 
texhash: Updating /usr/local/texlive/texmf-local/ls-R... 
texhash: Done.

运行texhash
这样就可以使用pdfLaTeX了


drawing_on_an_image.tex

\documentclass{article}
\usepackage{onimage}
\tikzset{annotations/.style = {
  tsx/show help lines,
  every path/.append style = {very thick, color = yellow},
  every node/.append style = {yellow,font = \bfseries\sffamily}}}
\begin{document}
\section{drawing on an image}
\begin{tikzonimage}[width=.8\textwidth]{dog}
    [annotations]
    \draw[dashed] (0.59,0.71)  -- (0.86,0.12)
                  (0.634,0.71) -- (0.86,0.12);
    \draw[dotted] (0.56,0.85)  -- (0.86,0.12)
                  (0.66,0.85)  -- (0.86,0.12);
    \draw (0.3,0.4) edge[->] (0.68,0.4)
          (0.3,0.4) edge[->] (0.3,0.93);
    \node[rotate=90] at (0.28,0.8) {height};
    \node            at (0.62,0.35) {velocity};
  \end{tikzonimage}
\end{document}

在这里插入图片描述
更多tex代码 cookbook
源代码:cookbook

总结

提示:仅供参考:

download dtx
latex dtx
generate sty
end
cp sty to dir of latex
pdflatex

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值