间距、子图和右侧标题(创建栏菜单)

间距、子图和右侧标题(创建栏菜单)

我正在尝试为我所在的学生场所创建酒吧菜单。现在,由于我们正在学习计算机科学、数学或物理,他当然必须使用乳胶来创建我们的酒吧菜单或饮品清单。下面给出了一个页面示例

在此处输入图片描述

现在的问题是如何简化菜单的创建过程。目前,我正在使用“floatrow”,以便能够使用侧边字幕。我想要实现的是,以某种简单的方式写入饮料配方和图像。菜单应该具有这些功能。

  • 左对齐的收据(不像图像中那样正确)。
  • 蓝色间距每边至少应为0.5厘米。
  • 红色间距尽量大一些。
  • 绿地间距宜小,但不宜为零。
  • 可以在图像下方的框中写入文本。
  • 图形应垂直对齐

如上图所示 =) 如果我尝试改变我的 MWE 以避免\raggedright文本的出现,则每个间距都是不一致的。 我使用了 floatrow 包,但是任何答案都不需要使用这个!

\documentclass[12pt,a4paper]{article}

\usepackage[landscape,        
        left=0.1cm,
        right=1cm,
        top=1cm,
        bottom=0cm]{geometry}
\usepackage{microtype,lmodern,fixltx2e}      % Småfikser og typografiske forbedringer
\usepackage{amsfonts,mathtools}               % Matematikk.
\usepackage[utf8]{inputenc}                  % Norske symboler æ,ø,å
\usepackage[norsk]{babel}                    % Norsk innholdsfortegnelse, og overskrifter

\usepackage{caption,subcaption}
\usepackage{floatrow}

\captionsetup[subfigure]{font = large,labelformat=brace,format=hang,justification=rightlast}
\floatsetup[figure]{style=plain}
\floatsetup[subfigure]{heightadjust=all,framearound=all,capbesideposition={left,center},capbesidesep=none}

\newcommand\rightlast{\leftskip0ptplus1fil
\rightskip0ptplus-1fil\parfillskip0ptplus1fil}
\DeclareCaptionJustification{rightlast}{\rightlast}

\begin{document}
\centering

\thisfloatsetup{capposition=beside,capbesideposition={left,center},
capbesidewidth=5cm} 
%
\section*{\LARGE $\mathbb{R}$ealfagskjelleren - Barkart - Side 1}
%
\vspace*{0.5cm}
%
\begin{figure}[H]
\ffigbox
    {\begin{subfloatrow}
        \fcapside[\FBwidth+2cm]{\caption*{%
        \textbf{\Large Sure Føtter} \\ 
                 Cointreau:  2 cl  \\
              Jägermeister:  2 cl  \\
                      Lime:  2 cl  \\ 
                 Coca Cola:\phantom{   2 cl} \\
                                   \\
                      Pris: 35 kr}  
        }{\includegraphics[scale=0.33]{SureFotter.jpg}}
        \fcapside[\FBwidth+2cm]{\caption*{%
        \textbf{\Large Kvit Russer}\\
                     Vodka:  2 cl  \\
            Kahlua/Amarula:  2 cl  \\
                     Fløte:  2 cl  \\ 
                                   \\
                      Pris: 35 kr} 
        }{\includegraphics[scale=0.125]{WhiteRussian.jpg}}

        \fcapside[\FBwidth+2cm]{\caption*{
        \textbf{\Large Crocodile}\\
                 Lys Rom:  2 cl  \\
                  Midori:  2 cl  \\
                    Lime:\phantom{   2 cl} \\
                  Sprite:\phantom{   2 cl} \\
                                 \\
                      Pris: 35 kr}      
        }{\includegraphics[scale=0.33]{Crocodile2.jpg}}
    \end{subfloatrow}   

    \renewlengthtocommand\settowidth\Mylen{100000\subfloatrowsep}\vskip\Mylen

    \begin{subfloatrow}
        \fcapside[\FBwidth+2cm]{{\caption*{
        \textbf{\Large Silver Salute}\\
                 Vodka:  1 cl  \\
             Cointreau:  2 cl  \\
              Blå Bols:  3 cl  \\
                                 \\
                      Pris: 40 kr}  
        }}{\includegraphics[scale=0.85]{SilverSalute2.jpg}}
        \fcapside[\FBwidth+2cm]{\caption*{
        \textbf{\Large Majoren}\\
          Captain Morgan:  2 cl  \\
            Jägermeister:  2 cl  \\
               Ingefærøl:\phantom{   2 cl} \\
                  Sitron:\phantom{   2 cl} \\
                                 \\
                      Pris: 35 kr}      
        }{\includegraphics[scale=0.35]{Major3.jpg}}
        \fcapside[\FBwidth+2cm]{\caption*{
        \textbf{\Large EPIC}    \\
               Baccardi:  2 cl  \\
               Blå bols:  1 cl  \\
            Mickey Finn:  1 cl  \\
                 Passoã:  1 cl  \\
                  Sprite:\phantom{   2 cl} \\
                                 \\
                      Pris: 40 kr}          
        }{\includegraphics[scale=0.15]{EPIC3.jpg}\hspace*{10cm}}%
    \end{subfloatrow}}

\end{figure}
\end{document}

就像我说的,我不知道如何使用 floatrow 包获得一致的间距。但如果可以使用其他包更轻松地创建菜单,并提供一致的间距,我完全赞成 =) floatrow 包有太多选项。

使用的图像

答案1

这是一种可能性。由于您的图像必须放在特定位置,我认为最好不要使用浮动环境。我建议采用不同的方法,使用框(在本例中为minipages)来放置信息:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[norsk]{babel}   
\usepackage[landscape,        
        left=1.5cm,
        right=1cm,
        top=3cm,
        bottom=0cm]{geometry}
\usepackage{graphicx}
\usepackage{microtype,fixltx2e}
\usepackage{fourier}
\usepackage{tikz}
\usepackage{etoolbox}

\newtoggle{client}

\newsavebox\mybox

\newcommand\tikzmark[1]{%
  \tikz[remember picture,overlay] \coordinate (#1);}

\colorlet{framecolor}{cyan!80!black}% color for frames (clients version)
\colorlet{ingrcolor}{orange!80!black}% color for frames around directions (bartenders version)

\setlength\parindent{0pt}

\newlength\framewd
\newlength\frameht
\newlength\legendwd
\newlength\descht
\newlength\imagewd
\newlength\rowsep% vertical spacing between rows
\setlength\framewd{7cm}% width of each frame
\setlength\legendwd{4cm}% with for ingredients
\setlength\imagewd{3cm}% width for image
\setlength\frameht{4.5cm}% height of the frame, without directions
\setlength\descht{1.5cm}% height of box for directions

\newcommand\framecon[5]{%
\begin{minipage}[t][\frameht][t]{\framewd}
\begin{minipage}[c][\frameht][t]{\framewd}
\begin{minipage}[c][\frameht][t]{\legendwd}
\vfill
{\bfseries\Large#1}\par\bigskip
\begin{tabular}{@{}r@{:\ }l@{}} 
  #2
  \multicolumn{2}{c}{} \\ 
  \fritem{Pris}{#3}
\end{tabular}%
\end{minipage}%
\begin{minipage}[c][\frameht][c]{\imagewd}
  \vfill
  \includegraphics[width=3cm]{#4}
\end{minipage}%
\end{minipage}%
\begin{lrbox}{\mybox}
  \begin{minipage}[c][\descht][t]{\dimexpr\framewd-20pt\relax}
  #5
  \end{minipage}%
\end{lrbox}%
\iftoggle{client}
  {}
  {\par\bigskip
    \tikz[remember picture]
    \node[rectangle,draw=ingrcolor,ultra thick,rounded corners,inner sep=8pt] 
      {\usebox\mybox};%
  }%
\par\vskip20pt\mbox{}\hfill\tikzmark{b}%
\end{minipage}%
\iftoggle{client}
  {%
  \begin{tikzpicture}[remember picture, overlay]
  \draw[rounded corners=8pt,line width=1.5pt,draw=framecolor]
  (b) -|
  ([xshift=\the\dimexpr-\framewd-1em\relax,yshift=\the\dimexpr\frameht+\descht\relax]b);
  \end{tikzpicture}
  }%
  {}
}

\newcommand\fritem[2]{#1&#2\\}

\begin{document}

\settoggle{client}{false}% for the bartender
%\settoggle{client}{true}% for the clients
\iftoggle{client}{\setlength\rowsep{6cm}}{\setlength\rowsep{3cm}}

\framecon{Sure Føtter}{%
  \fritem{Cointreau}{2 cl}
  \fritem{Jägermeister}{2 cl}
  \fritem{Lime}{2 cl}
  \fritem{Coca Cola}{}}{35kr}{11}{%
Shake vodka og likør med is i en cocktail shaker. -- Si til et højt glas med et par isterninger. -- Fyld op med orange juice.}\hfill
\framecon{Kvit Russer}{%
  \fritem{Vodka}{2 cl}
  \fritem{Kahlua/Amarula}{2 cl}
  \fritem{Fløte}{2 cl}}{35 kr}{12}{%
Alle ingredienser unntatt epleskive ristes godt i en shaker med knust is. -- Siles og serveres i et avkjølt cocktailglass. -- Pyntes med epleskive.}\hfill 
\framecon{Crocodile}{%
  \fritem{Lys Rom}{2 cl}
  \fritem{Midori}{2 cl}
  \fritem{Lime}{}
  \fritem{Sprite}{}}{35 kr}{13}{%
Shake vodka og likør med is i en cocktail shaker. -- Si til et højt glas med et par isterninger. -- Fyld op med orange juice.}

\vspace{\rowsep}

\framecon{Silver Salute}{%
  \fritem{Vodka}{1 cl}
  \fritem{Cointreau}{2 cl}
  \fritem{Blå Bols}{3 cl}}{40 kr}{21}{%
Alle ingredienser unntatt mørk rom ristes godt i en shaker med knust is. -- Serveres i et avkjølt collinsglass. -- Mørk rom helles forsiktig øverst i glasset. -- Pyntes med limeskive.}\hfill 
\framecon{Majoren}{%
  \fritem{Vodka}{1 cl}
  \fritem{Cointreau}{2 cl}
  \fritem{Blå Bols}{3 cl}}{40 kr}{22}{%
Alle ingredienser unntatt mørk rom ristes godt i en shaker med knust is. -- Serveres i et avkjølt collinsglass. -- Mørk rom helles forsiktig øverst i glasset. -- Pyntes med limeskive.}\hfill 
\framecon{Epic}{%
  \fritem{Baccardi}{2 cl}
  \fritem{Blå bols}{1 cl}
  \fritem{Mickey Finn}{1 cl}
  \fritem{Passoã}{1 cl}
  \fritem{Sprite}{}}{40 kr}{23}{%
Alle ingredienser unntatt mørk rom ristes godt i en shaker med knust is. -- Serveres i et avkjølt collinsglass. -- Mørk rom helles forsiktig øverst i glasset. -- Pyntes med limeskive.} 

\end{document}

客户版本(无准备说明):

在此处输入图片描述

只需将开关设置为 false,您就可以获得调酒师版本(附带准备说明):

在此处输入图片描述

代码如何工作

  • 主命令有\framecon五个强制参数:

    \framecon{<name>}{<ingredients>}{<price>}{<image-file>}{<prep. directions>}
    
  • 为了写入成分,\fitem定义了一个附加命令:

    \fritem{<ingredient>}{<quantity>}
    

    因此,例如,我的示例中“EPIC”的条目是:

    \framecon{Epic}{%
      \fritem{Baccardi}{2 cl}
      \fritem{Blå bols}{1 cl}
      \fritem{Mickey Finn}{1 cl}
      \fritem{Passoã}{1 cl}
      \fritem{Sprite}{}}{40 kr}{23}{%
    Alle ingredienser unntatt mørk rom ristes godt i en shaker med knust is. -- Serveres i et avkjølt collinsglass. -- Mørk rom helles forsiktig øverst i glasset. -- Pyntes med limeskive.} 
    
  • 将开关设置clienttrue,将生成客户端版本,将其设置为false,将获得调酒师的版本。

对于每行少于四幅图像的情况,可以插入\hfills 来产生所需的对齐:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[norsk]{babel}   
\usepackage[landscape,        
        left=1.5cm,
        right=1cm,
        top=3cm,
        bottom=0cm]{geometry}
\usepackage{graphicx}
\usepackage{microtype,fixltx2e}
\usepackage{fourier}
\usepackage{tikz}
\usepackage{etoolbox}

\newtoggle{client}

\newsavebox\mybox

\newcommand\tikzmark[1]{%
  \tikz[remember picture,overlay] \coordinate (#1);}

\colorlet{framecolor}{cyan!80!black}% color for frames (clients version)
\colorlet{ingrcolor}{orange!80!black}% color for frames around directions (bartenders version)

\setlength\parindent{0pt}

\newlength\framewd
\newlength\frameht
\newlength\legendwd
\newlength\descht
\newlength\imagewd
\newlength\rowsep% vertical spacing between rows
\setlength\framewd{7cm}% width of each frame
\setlength\legendwd{4cm}% with for ingredients
\setlength\imagewd{3cm}% width for image
\setlength\frameht{4.5cm}% height of the frame, without directions
\setlength\descht{1.5cm}% height of box for directions

\newcommand\framecon[5]{%
\begin{minipage}[t][\frameht][t]{\framewd}
\begin{minipage}[c][\frameht][t]{\framewd}
\begin{minipage}[c][\frameht][t]{\legendwd}
\vfill
{\bfseries\Large#1}\par\bigskip
\begin{tabular}{@{}r@{:\ }l@{}} 
  #2
  \multicolumn{2}{c}{} \\ 
  \fritem{Pris}{#3}
\end{tabular}%
\end{minipage}%
\begin{minipage}[c][\frameht][c]{\imagewd}
  \vfill
  \includegraphics[width=3cm]{#4}
\end{minipage}%
\end{minipage}%
\begin{lrbox}{\mybox}
  \begin{minipage}[c][\descht][t]{\dimexpr\framewd-20pt\relax}
  #5
  \end{minipage}%
\end{lrbox}%
\iftoggle{client}
  {}
  {\par\bigskip
    \tikz[remember picture]
    \node[rectangle,draw=ingrcolor,ultra thick,rounded corners,inner sep=8pt] 
      {\usebox\mybox};%
  }%
\par\vskip20pt\mbox{}\hfill\tikzmark{b}%
\end{minipage}%
\iftoggle{client}
  {%
  \begin{tikzpicture}[remember picture, overlay]
  \draw[rounded corners=8pt,line width=1.5pt,draw=framecolor]
  (b) -|
  ([xshift=\the\dimexpr-\framewd-1em\relax,yshift=\the\dimexpr\frameht+\descht\relax]b);
  \end{tikzpicture}
  }%
  {}
}

\newcommand\fritem[2]{#1&#2\\}

\begin{document}

\settoggle{client}{false}% for the bartender
%\settoggle{client}{true}% for the clients
\iftoggle{client}{\setlength\rowsep{6cm}}{\setlength\rowsep{3cm}}

\hfill\framecon{Sure Føtter}{%
  \fritem{Cointreau}{2 cl}
  \fritem{Jägermeister}{2 cl}
  \fritem{Lime}{2 cl}
  \fritem{Coca Cola}{}}{35kr}{11}{%
Shake vodka og likør med is i en cocktail shaker. -- Si til et højt glas med et par isterninger. -- Fyld op med orange juice.}\hfill
\framecon{Kvit Russer}{%
  \fritem{Vodka}{2 cl}
  \fritem{Kahlua/Amarula}{2 cl}
  \fritem{Fløte}{2 cl}}{35 kr}{12}{%
Alle ingredienser unntatt epleskive ristes godt i en shaker med knust is. -- Siles og serveres i et avkjølt cocktailglass. -- Pyntes med epleskive.}\hfill\null

\vspace{\rowsep}

\hfill\framecon{Silver Salute}{%
  \fritem{Vodka}{1 cl}
  \fritem{Cointreau}{2 cl}
  \fritem{Blå Bols}{3 cl}}{40 kr}{21}{%
Alle ingredienser unntatt mørk rom ristes godt i en shaker med knust is. -- Serveres i et avkjølt collinsglass. -- Mørk rom helles forsiktig øverst i glasset. -- Pyntes med limeskive.}\hfill 
\framecon{Majoren}{%
  \fritem{Vodka}{1 cl}
  \fritem{Cointreau}{2 cl}
  \fritem{Blå Bols}{3 cl}}{40 kr}{22}{%
Alle ingredienser unntatt mørk rom ristes godt i en shaker med knust is. -- Serveres i et avkjølt collinsglass. -- Mørk rom helles forsiktig øverst i glasset. -- Pyntes med limeskive.}\hfill\null

\end{document}

在此处输入图片描述

相关内容