From 489f53a036ac76ab0ee87fd1522e9adff3b7d9df Mon Sep 17 00:00:00 2001 From: Yoshimura Yuu Date: Sun, 21 Jul 2024 20:42:26 +0900 Subject: [PATCH] Update Ubuntu & Pandoc --- docker/Dockerfile | 29 ++++++++++++----------------- requirements.txt | 1 - scala_text.tex | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 18 deletions(-) delete mode 100644 requirements.txt diff --git a/docker/Dockerfile b/docker/Dockerfile index 78fefda..009e5b9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,12 +1,10 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 LABEL maintainer="YOSHIMRUA Hikaru " -ARG TARGETARCH - RUN apt-get update -ENV PERSISTENT_DEPS \ +ENV PERSISTENT_DEPS='\ openjdk-11-jdk \ python3-pip \ wget \ @@ -19,11 +17,12 @@ ENV PERSISTENT_DEPS \ lz4 \ ca-certificates \ unzip \ - fontconfig + fontconfig \ + python3-pandocfilters' RUN apt-get install -y --no-install-recommends $PERSISTENT_DEPS # Setup fonts -ENV FONT_PATH /usr/share/fonts/ +ENV FONT_PATH=/usr/share/fonts/ RUN mkdir -p $FONT_PATH && \ # Source Code Pro wget "https://github.com/adobe-fonts/source-code-pro/releases/download/2.038R-ro%2F1.058R-it%2F1.018R-VAR/OTF-source-code-pro-2.038R-ro-1.058R-it.zip" && \ @@ -32,23 +31,19 @@ RUN mkdir -p $FONT_PATH && \ rm -rf OTF-source-code-pro-2.038R-ro-1.058R-it.zip source-code-pro && \ fc-cache -f -v +ARG TARGETARCH + # Install Pandoc -ENV PANDOC_VERSION 2.19 -ENV PANDOC_DOWNLOAD_URL https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-linux-$TARGETARCH.tar.gz -ENV PANDOC_ROOT /usr/local/bin/pandoc +ENV PANDOC_VERSION=3.2.1 +ENV PANDOC_DOWNLOAD_URL="https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-linux-$TARGETARCH.tar.gz" +ENV PANDOC_ROOT=/usr/local/bin/pandoc RUN wget -qO- "$PANDOC_DOWNLOAD_URL" | tar -xzf - && \ cp pandoc-$PANDOC_VERSION/bin/pandoc $PANDOC_ROOT && \ rm -Rf pandoc-$PANDOC_VERSION/ -# Install Pandocfilter -COPY requirements.txt ./ -RUN pip install --upgrade pip && \ - pip install -r requirements.txt && \ - rm requirements.txt - # Install TeXLive ARG TEXLIVE_OPTIONS="" -ENV TEXLIVE_PATH /usr/local/texlive +ENV TEXLIVE_PATH=/usr/local/texlive RUN mkdir /tmp/install-tl-unx && \ wget -qO- http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz | \ tar -xz -C /tmp/install-tl-unx --strip-components=1 && \ @@ -69,7 +64,7 @@ RUN mkdir /tmp/install-tl-unx && \ $TEXLIVE_OPTIONS; \ fi -ENV PATH $TEXLIVE_PATH/bin/aarch64-linux:$TEXLIVE_PATH/bin/x86_64-linux:/bin:$PATH +ENV PATH="$TEXLIVE_PATH/bin/aarch64-linux:$TEXLIVE_PATH/bin/x86_64-linux:/bin:$PATH" RUN tlmgr $TEXLIVE_OPTIONS install latexmk collection-luatex collection-langjapanese \ collection-fontsrecommended filehook type1cm mdframed needspace \ fncychap everyhook svn-prov zref sourcesanspro \ diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a9c0040..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pandocfilters>=1.4.2 diff --git a/scala_text.tex b/scala_text.tex index f541454..3fc662a 100644 --- a/scala_text.tex +++ b/scala_text.tex @@ -104,6 +104,23 @@ % Pandocの画像を適切に表示させるため \setkeys{Gin}{keepaspectratio} +% Pandoc用 +% https://github.com/jgm/pandoc/blob/501d7cc02d8ed694e32f26756bc433250d34b193/data/templates/default.latex#L304-L317 +\makeatletter +\newsavebox\pandoc@box +\newcommand*\pandocbounded[1]{% scales image to fit in text height/width + \sbox\pandoc@box{#1}% + \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}% + \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}% + \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both + \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}% + \else\usebox{\pandoc@box}% + \fi% +} +% Set default figure placement to htbp +\def\fps@figure{htbp} +\makeatother + \begin{document} \begin{luacode*}