AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题

问题[latex](unix)

Martin Hope
Alexis Dumas
Asked: 2021-12-10 17:27:23 +0800 CST

使用 Pandoc 将 Markdown 转换为 PDF:使页面具有特定大小,以英寸为单位

  • 0

所以我知道你可以使用pagesize和geometry设置 Pandoc 预设的 PDF 的页面大小(如 a5、b5 等),但是有没有办法设置一对精确的尺寸?我将使用带有 Amazon Self-Publishing(平装本)的 PDF,并且我需要页面正好是 5x8 英寸,因为这是 KDP 与我想要的最接近的设置。谢谢!

pdf latex
  • 1 个回答
  • 287 Views
Martin Hope
Manfredo
Asked: 2020-02-05 08:56:31 +0800 CST

转换书目参考以与 Latex 一起使用

  • 4

我收到了一份长字文档,我必须将其移植到 Latex 中。在文档中,所有引文都以带有作者和年份的经典形式出现。就像是

Lorem ipsum dolor (Sit, 1998) amet, consectetur adipiscing (Slit 2000, Sed and So 2002, Eiusmod et al. 1976).
Tempor incididunt ut labore et dolore magna aliqua (Ut et al. 1312)

此引用需要获得正确的关键引用,因为它出现在围兜引用列表中。换句话说,文本应该翻译成

Lorem ipsum dolor \cite{sit1998} amet, consectetur adipiscing \cite{slit2000,sed2002,eiusmod1976}.
Tempor incididunt ut labore et dolore magna aliqua \cite{ut1312}

这意味着:

  • 提取由括号中的名称和年份组成的所有字符串
  • 去掉那一串空格、第二个名字(名字后面的所有内容)和大写字母
  • 使用生成的字符串形成新的 \cite{string}

我知道这可能是一项相当复杂的任务。我想知道也许有人为此特定任务编写了脚本。或者,也欢迎任何部分建议。我目前在 MacOS 中工作。

text-processing latex
  • 1 个回答
  • 126 Views
Martin Hope
user1509669
Asked: 2019-07-28 00:42:37 +0800 CST

仅当 tex 文件有参考书目时,Makefile 才运行 bibtex 命令

  • 0

我想要一个包含任意数量的 .tex 文件的文件夹,我将在其中拥有一个 Makefile,它会在make运行时为每个 .tex 文件生成一个 .pdf 文件。我的限制是一些但不是所有的 .tex 文件都有参考书目。带有参考书目的 .tex 文件将有条件地使用 bibtex 工具生成 .bbl 文件,以在最终 .pdf 文件中构建参考。这是必需的,因为如果 bibtex 没有找到文本中引用的参考书目,它将返回错误代码并中止构建过程。下面是生成文件的建议解决方案,它不起作用,因为 ifneq 没有​​评估 FILE_BIBS 的值。

Makefile(注意:四个空格应该用制表符代替,否则解释器将无法正常工作)

SOURCES:=$(wildcard $(SRC_DIR)*.tex)
BIBS:=$(wildcard $(SRC_DIR)*.bib)
OUTPUT:=$(patsubst %.tex, %.pdf, $(SOURCES))

.PHONY: all
all: $(OUTPUT) 

# Build procedure for all .tex files
%.pdf: %.tex $(BIBS) 
    pdflatex $(patsubst %.tex, %, $<) > /dev/null
    # Scan the current .tex file for the phrase \bibliography and put the text
    # into a variable called FILE_BIBS, if there is no bibliography phrase in 
    # the file, FILE_BIBS will be empty
    $(eval FILE_BIBS=$(shell grep -m 1 '^[[:space:]]*\\bibliography[[:space:]]*{' $< | sed 's/\\//g' | sed 's/{//g' | sed 's/}//g'))
    echo $(FILE_BIBS)
    # If there are .bib files in the project 
ifneq ($(BIBS),)
    echo "there are bibs FILE_BIBS: $(FILE_BIBS)"
    # See if FILE_BIBS is not empty (the file uses a bibliography)
ifneq ($(FILE_BIBS),)
    # This should print out for outline.tex and not for outline2.tex
    # This does not print out in either case
    echo "file has bib"
    bibtex $(patsubst %.tex, %, $<) > /dev/null
    pdflatex $(patsubst %.tex, %, $<) > /dev/null
endif
endif
    pdflatex $(patsubst %.tex, %, $<) > /dev/null

.PHONY: clean
clean:
    -rm -f *.pdf *.log *.out *.aux *.dvi *.blg *.bbl 

大纲.tex

\documentclass{article}
\usepackage{natbib}
\bibliographystyle{apa}

\begin{document}

Types of integration \cite[81-82]{INCOSE-Handbook}.

\bibliography{references}{}

\end{document}

大纲2.tex

\documentclass{article}

\begin{document}

Hello.

\end{document}

参考文献.bib

@BOOK{INCOSE-Handbook,
  TITLE = {Systems Engineering Handbook},
  SUBTITLE = {A guide for system life cycle processes and activities},
  AUTHOR = {Walden, David D. and Roedler, Gerry J. and Forsberg, Kevin J. and Hamelin, R. Douglas and Shortell, Thomas M.},
  YEAR = {2015},
  PUBLISHER = {Wiley},
  EDITION = 4,
  ADDRESS = {7670 Opportunity Rd., Suite 220 San Diego, CA, USA 92111-2222}
}

输出

$ make 
pdflatex  outline2 > /dev/null
echo 
echo "there are bibs FILE_BIBS: "
there are bibs FILE_BIBS: 
pdflatex  outline2 > /dev/null
pdflatex  outline > /dev/null
echo bibliographybibliography
bibliographybibliography
echo "there are bibs FILE_BIBS: bibliographybibliography"
there are bibs FILE_BIBS: bibliographybibliography
pdflatex  outline > /dev/null

我们希望在构建大纲时看到 bibtex 调用,但我们没有。这表明第二个 ifneq 工作不正常。

Makefile 不起作用,因为第二个ifneq不起作用,当FILE_BIBS非空时评估 true。建议应允许用户通过运行在文件夹中构建所有 .tex 文件,make建议解决方案之外的新解决方案应仅使用命令行interface、make、pdftex、bibtex 和 Unix/Linux 环境中的标准工具,例如 awk、sed、grep。

make latex
  • 1 个回答
  • 337 Views
Martin Hope
user56980
Asked: 2019-04-15 21:41:45 +0800 CST

如何在 Alpine Linux 上安装 TeXLive?

  • 3

是否可以使用 tlmgr 实用程序(来自 tug.org)安装 texlive?从源(而不是 AppImage、flatpack 或 snap 包)安装 texmaker(或 texstudio)乳胶编辑器的相同问题。谢谢!

alpine-linux latex
  • 1 个回答
  • 2884 Views
Martin Hope
il mietitore
Asked: 2018-10-25 07:41:08 +0800 CST

TexLive 2018,安装 Debian 后“更新”一些文件并破坏它

  • 0

在我通过官方安装程序(这个)安装最新版本的 TexLive 之后,如果我运行sudo apt-get update && sudo apt-get dist-upgradeapt-get 会发现一系列要更新的包,我认为与包相关tex-common。不过,此类软件包并未更新,而是指 2016 年以来较旧的 TeXlive 发行版。

当然这会产生问题,因为如果我pdflatex -v在这样的更新之后运行,我会发现 pdflatex 正在尝试使用 TeXlive 的 2016,而不是 2018,并且任何文档的导出都将不起作用。

在 Ubuntu 上我会用 PPA 解决这个问题,但是 PPA 不是为 Debian 制作的,事实上 TexLive 的 PPA 在这里不能正常工作。

有没有办法永久告诉 Debian 不要用他在存储库中找到的软件包更新这些软件包?

编辑:

事实证明和我解释的不一样,所以我这里的问题是完全错误的,因此必须忽略/删除。

debian latex
  • 1 个回答
  • 109 Views
Martin Hope
msampaio
Asked: 2018-03-23 14:47:33 +0800 CST

如何用 sed 查找和替换特定行的特定部分?

  • 1

我有一个包含以下行的LaTeX文件:foo.tex

\includegraphics[width=0.49\textwidth]{img1}
\includegraphics{img2}
\subfloat{\includegraphics[width=0.3\textwidth]{img3}}
\subfloat{\includegraphics{img4}}

我想替换文件中的这些行以添加文件扩展名,如下所示:

\includegraphics[width=0.49\textwidth]{img1.png}
\includegraphics{img2.png}
\subfloat{\includegraphics[width=0.3\textwidth]{img3.png}}
\subfloat{\includegraphics{img4.png}}

我开始尝试使用sed此命令:

cat foo.tex | sed 's/\(includegraphics.*[a-z,0-9,\-]}\)/\1.png}/g' > bar.tex

但它返回:

\includegraphics[width=0.49\textwidth]{img1}.png
\includegraphics{img2}.png
\subfloat{\includegraphics[width=0.3\textwidth]{img3}.png}
\subfloat{\includegraphics{img4}.png}

如何修复我的sed命令以添加文件扩展名?

编辑

图像文件名不仅是 img1、img2 等。

sed latex
  • 1 个回答
  • 63 Views
Martin Hope
Alexey
Asked: 2018-03-01 09:31:39 +0800 CST

在 NixOS 上安装 CMU 字体

  • 4

我发现我需要CMU 字体才能使用 XeLaTeX 排版俄语文本。在 NixOS 下有它的cm-unicode包,我已经安装了它

nix-env -iA nixos.cm_unicode

但 XeLaTeX 仍然找不到它。我可以在 Ubuntu 上使用 XeLaTeX 编译的 LaTeX 文件在 NixOS 上无法使用 XeLaTeX 编译,并且我收到一条错误消息,指出找不到我指示的 CMU 字体。

我了解到我可以使用 列出系统上安装的所有字体fc-list,因此我尝试运行fc-list | grep -i cmu, fc-list | grep -i com, fc-list | grep -i unic,但没有得到任何结果。

我怎样才能安装这个字体? 这是针对 NixOS 17.09 的。


顺便说一句,我已经不得不手动安装拉丁现代字体:它最初无法在 XeLaTeX 中选择,但是在我安装了带有 的lmodern包后nix-env -i,它工作正常。

我刚刚再次对此进行了测试:卸载lmodernwith会从和nix-env -efrom 的结果中删除 Latin Modern ,安装 with会恢复它。与.fc-listfont-managernix-env -icm_unicode


我有一个可能相关的问题,所以我把它放在这里。(如果事实证明它不相关,我将不胜感激简短的评论或解释。)

我想在我的 中定义我的 TeX Live 环境及其所有依赖项.nixpkgs/config.nix,所以我做了

# .nixpkgs/config.nix
{ # ...
  packageOverrides = pkgs: {
    myTexLive = pkgs.texlive.combine {
      inherit (pkgs.texlive) scheme-basic
                             collection-bibtexextra
                             collection-fontsrecommended
                             collection-genericrecommended
                             collection-langcyrillic
                             collection-langfrench
                             collection-latex
                             collection-latexextra
                             collection-latexrecommended
                             collection-mathextra
                             collection-xetex
                             cm-unicode  # from `collection-fontsextra`
                             latexmk
                             lm       # from `collection-fontsrecommended`
                             lm-math  # from `collection-fontsrecommended`
                             texdoc;
    };
}

我希望拥有lm和cm-unicodeTeX Live 软件包足以安装 Latin Modern 和 CMU 字体,但它不起作用。

有没有办法将必要的字体声明为依赖项myTexLive?

fonts latex
  • 1 个回答
  • 1267 Views
Martin Hope
Lutosław
Asked: 2018-01-24 06:08:47 +0800 CST

如何在 Ubuntu 17.04 上安装 Latex 发行版?

  • 0

如何在 Ubuntu 17.04 上安装 Latex 发行版?

我试过了:

sudo apt install --fix-missing texlive-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apt-show-versions debugedit libauthen-pam-perl libblas-common libblas3 libgfortran3 liblapack3 libqt4-designer libqt4-help libqt4-scripttools libqt4-test
  libqtassistantclient4 libqwt5-qt4 librpmbuild3 librpmsign3 libsqlite0 linux-headers-4.10.0-37 linux-headers-4.10.0-37-generic linux-headers-4.10.0-38
  linux-headers-4.10.0-38-generic linux-image-4.10.0-37-generic linux-image-4.10.0-38-generic linux-image-extra-4.10.0-37-generic
  linux-image-extra-4.10.0-38-generic python-libxml2 python-lzma python-numpy python-pycurl python-qt4 python-rpm python-sip python-six python-sqlite
  python-sqlitecachec python-urlgrabber rpm
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  fonts-lmodern libpotrace0 libptexenc1 libsynctex1 libtexlua52 libtexluajit2 libzzip-0-13 lmodern tex-common texlive-binaries
Suggested packages:
  debhelper perl-tk
The following NEW packages will be installed:
  fonts-lmodern libpotrace0 libptexenc1 libsynctex1 libtexlua52 libtexluajit2 libzzip-0-13 lmodern tex-common texlive-base texlive-binaries
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 23,8 MB/38,0 MB of archives.
After this operation, 126 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 http://pl.archive.ubuntu.com/ubuntu zesty/main amd64 libpotrace0 amd64 1.13-3
  404  Not Found
Err:2 http://pl.archive.ubuntu.com/ubuntu zesty/main amd64 libptexenc1 amd64 2016.20160513.41080.dfsg-1
  404  Not Found
Err:3 http://pl.archive.ubuntu.com/ubuntu zesty/main amd64 libsynctex1 amd64 2016.20160513.41080.dfsg-1
  404  Not Found
Err:4 http://pl.archive.ubuntu.com/ubuntu zesty/main amd64 libtexlua52 amd64 2016.20160513.41080.dfsg-1
  404  Not Found
Err:5 http://pl.archive.ubuntu.com/ubuntu zesty/main amd64 libtexluajit2 amd64 2016.20160513.41080.dfsg-1
  404  Not Found
Err:6 http://pl.archive.ubuntu.com/ubuntu zesty-updates/main amd64 libzzip-0-13 amd64 0.13.62-3ubuntu0.17.04.1
  404  Not Found
Ign:7 http://pl.archive.ubuntu.com/ubuntu zesty/main amd64 tex-common all 6.06
Err:8 http://pl.archive.ubuntu.com/ubuntu zesty/main amd64 texlive-binaries amd64 2016.20160513.41080.dfsg-1
  404  Not Found
Ign:9 http://pl.archive.ubuntu.com/ubuntu zesty/main amd64 texlive-base all 2016.20170123-5
Err:7 http://pl.archive.ubuntu.com/ubuntu zesty/main i386 tex-common all 6.06
  404  Not Found
Err:9 http://pl.archive.ubuntu.com/ubuntu zesty/main i386 texlive-base all 2016.20170123-5
  404  Not Found
Err:6 http://security.ubuntu.com/ubuntu zesty-security/main amd64 libzzip-0-13 amd64 0.13.62-3ubuntu0.17.04.1
  404  Not Found
Unable to correct missing packages.                    
E: Failed to fetch http://pl.archive.ubuntu.com/ubuntu/pool/main/p/potrace/libpotrace0_1.13-3_amd64.deb  404  Not Found
E: Failed to fetch http://pl.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/libptexenc1_2016.20160513.41080.dfsg-1_amd64.deb  404  Not Found
E: Failed to fetch http://pl.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/libsynctex1_2016.20160513.41080.dfsg-1_amd64.deb  404  Not Found
E: Failed to fetch http://pl.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/libtexlua52_2016.20160513.41080.dfsg-1_amd64.deb  404  Not Found
E: Failed to fetch http://pl.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/libtexluajit2_2016.20160513.41080.dfsg-1_amd64.deb  404  Not Found
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/z/zziplib/libzzip-0-13_0.13.62-3ubuntu0.17.04.1_amd64.deb  404  Not Found
E: Failed to fetch http://pl.archive.ubuntu.com/ubuntu/pool/main/t/tex-common/tex-common_6.06_all.deb  404  Not Found
E: Failed to fetch http://pl.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/texlive-binaries_2016.20160513.41080.dfsg-1_amd64.deb  404  Not Found
E: Failed to fetch http://pl.archive.ubuntu.com/ubuntu/pool/main/t/texlive-base/texlive-base_2016.20170123-5_all.deb  404  Not Found
E: Aborting install.

它不存在于 Ubuntu 软件中。

PS。我知道 Ubuntu 17.04 不受支持,但它是唯一可以与我的 GTX 960 一起使用的版本。现在可能已经修复了较新的版本,但我不想再冒着被笔记本电脑变砖的风险。

ubuntu latex
  • 1 个回答
  • 617 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve