如何在小页面上扩展逐字环境?

如何在小页面上扩展逐字环境?

我有一个简单的 vebatim 环境。问题12太复杂了,难以理解。我只想居中对齐并重新缩放 ASCII 艺术徽标。MWE:

 \documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum, caption}  

\begin{document}
\begin{figure}[!b]
    \centering 
    \begin{minipage}[b]{0.5\linewidth}
            \begin{verbatim}
       __  ____      _ __   ________
      /  |/  (_)__  (_) /  / __/ __/
     / /|_/ / / _ \/ / /___\ \_\ \
    /_/  /_/_/_//_/_/____/___/___/

        \end{verbatim}
            \captionof{figure}{logo1}
    \label{interpt1}
    \end{minipage}\hspace*{5mm}
    \begin{minipage}[b]{0.3\linewidth}
    \centering
        \begin{verbatim}
       __  ____      _ __   ________
      /  |/  (_)__  (_) /  / __/ __/
     / /|_/ / / _ \/ / /___\ \_\ \
    /_/  /_/_/_//_/_/____/___/___/

        \end{verbatim}
    \captionof{figure}{logo2}
    \label{interpt2}
    \end{minipage}
\end{figure}
\end{document}

照片

迷你盒子很容易理解,所以我就使用了它。

答案1

verbatimbox可以帮助。

\documentclass{article}
\usepackage{amsmath,verbatimbox}
\usepackage{lipsum, caption}  
\usepackage[showframe,pass]{geometry}
\begin{document}
\begin{figure}[ht]
    \centering \smallskip
\begin{verbbox}[\small]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{verbbox}
    \begin{minipage}[b]{0.5\linewidth}
\theverbbox
\captionof{figure}{logo1}
\label{interpt1}
\end{minipage}\hspace*{5mm}
\begin{minipage}[b]{0.3\linewidth}
    \centering
\begin{verbbox}[\tiny]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{verbbox}
\theverbbox
\captionof{figure}{logo2}
\label{interpt2}
\end{minipage}
\end{figure}
\begin{figure}[ht]
\centering
\begin{verbbox}[\LARGE]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{verbbox}
\theverbbox
\caption{Here is my scaled verbatim}
\end{figure}
\end{document}

在此处输入图片描述

答案2

使用你的第二个链接我得到了这些结果 在此处输入图片描述

\documentclass[9pt]{article}
\usepackage{amsmath,adjustbox,fancyvrb,caption}
\usepackage{lipsum}  


\newenvironment{myverb}{%
 \VerbatimEnvironment
 \begin{adjustbox}{max width=\linewidth}
 \begin{BVerbatim}
  }{
  \end{BVerbatim}
 \end{adjustbox}
}

\begin{document}

\begin{figure}[!h]\centering \Huge % \huge \LARGE \Large \large these are case sensitive simply move the % comment to the right for smaller
\begin{myverb}
       __  ____      _ __   ________
      /  |/  (_)__  (_) /  / __/ __/
     / /|_/ / / _ \/ / /___\ \_\ \
    /_/  /_/_/_//_/_/____/___/___/
\end{myverb}
  \captionof{figure}{Huge 1}
  \label{interpt2}
\end{figure}

  \vspace{0.5cm}

\begin{figure}[!h]\centering \small \footnotesize \scriptsize \tiny %these are case sensitive simply move the % comment to the left for larger
\begin{myverb}
       __  ____      _ __   ________
      /  |/  (_)__  (_) /  / __/ __/
     / /|_/ / / _ \/ / /___\ \_\ \
    /_/  /_/_/_//_/_/____/___/___/
\end{myverb}
  \captionof{figure}{Tiny 2}
  \label{interpt2}
\end{figure}

\end{document}

答案3

您可以使用BVerbatim来自fancyvrb

不要缩进逐字环境,因为行首的空格是受尊重的。

\documentclass{article}
\usepackage{amsmath}
\usepackage{fancyvrb}
\usepackage{lipsum, caption}  

\begin{document}

\lipsum[1-2] % just to force bottom figures

\begin{figure}[!b]
\centering
\begin{BVerbatim}[fontsize=\scriptsize]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{BVerbatim}
\caption{logo1}\label{interpt1}
\end{figure}

\begin{figure}[!b]
\centering
\begin{BVerbatim}[fontsize=\fontsize{5}{6}\selectfont]
   __  ____      _ __   ________
  /  |/  (_)__  (_) /  / __/ __/
 / /|_/ / / _ \/ / /___\ \_\ \
/_/  /_/_/_//_/_/____/___/___/
\end{BVerbatim}
\caption{logo2}\label{interpt2}
\end{figure}

\end{document}

在此处输入图片描述

相关内容