我正在嘗試為我所在的學生場所創建一個酒吧菜單。現在,由於我們正在學習電腦科學、數學和/或物理,他當然必須使用乳膠來創建我們的酒吧菜單或酒單。下面給了一個頁面範例
現在的問題是如何使建立選單的過程變得更容易。目前我正在使用“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-package 有太多選項。
使用的影像
答案1
這是一種可能性。由於您的影像必須位於特定的位置,因此我認為最好不要使用浮動環境。我提出了一種不同的方法,使用框框(在本例中為minipage
s)來放置資訊:
\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\\}
\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.}
將切換設定
client
為true
,將產生客戶端版本,並將其設定為false
,將取得調酒師的版本。
對於每行少於四個影像,可以插入\hfill
s 產生所需的對齊方式:
\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\\}
\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}