Skip to content

Commit

Permalink
Update Ubuntu & Pandoc
Browse files Browse the repository at this point in the history
  • Loading branch information
y-yu committed Jul 21, 2024
1 parent 4777db9 commit 489f53a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
29 changes: 12 additions & 17 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

LABEL maintainer="YOSHIMRUA Hikaru <yyu [at] mental.poker>"

ARG TARGETARCH

RUN apt-get update

ENV PERSISTENT_DEPS \
ENV PERSISTENT_DEPS='\
openjdk-11-jdk \
python3-pip \
wget \
Expand All @@ -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" && \
Expand All @@ -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 && \
Expand All @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

17 changes: 17 additions & 0 deletions scala_text.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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*}
Expand Down

0 comments on commit 489f53a

Please sign in to comment.