文本小页面的边距问题

文本小页面的边距问题

在此处输入图片描述我正在写一份餐厅菜单,但这一页的左边距有问题,特别是在“葡萄酒”段落中。如果我省略 \vfill,代码会使两个段落重叠,但会使它们的左边距相同;而使用 vfill 创建垂直空间会改变第二个段落的边距。有人能帮我吗?

\documentclass[12pt,italian]{article}
\usepackage{geometry}
\geometry{a4paper,top=2.5cm,bottom=2cm,left=2cm,right=2cm,bindingoffset=5mm}
\usepackage[utf8x]{inputenc}
\usepackage[italian]{babel}
\usepackage{xcolor} 
\usepackage{graphicx}
\usepackage{fourier}
\usepackage{eurosym}
\pagestyle{empty}
\begin{document}
    \begin{minipage}[c][0.5\textheight][c]{\textwidth}{
    \begin{center}
        \LARGE{ \underline{SECONDI} \\
            \color{red}{\underline{MAIN COUSES}}}
    \end{center}
    \vspace{.015\textheight}
    Tagliata di pollo con rucola e grana \hfill{12.00 \euro}
    \newline
    \textcolor{red}{Thinly cut grilled chicken with rocket salad and parmesan cheese}
    \newline
    Ossobuco alla fiorentina con patate arrosto \hfill{16.00 \euro}
    \newline
    \textcolor{red}{Florence’s traditional braised veal shanks with roasted potatoes}
    \newline
    Trancio di salmone alla paprika dolce, patate fritte, pomodoro e melanzane grigliate \hfill{15.00 \euro}
    \newline
    \textcolor{red}{Salmon with sweet paprika, french fries and grilled tomato and eggplant}
    \newline
    Bistecca alla Fiorentina per due persone \hfill{4.00 \euro \hspace{0.001\textwidth} all'etto}
    \newline
    \textcolor{red}{Fiorentina Steak (40,00€ per kilogram)}
    \newline
    Tagliata di manzo con rucola e grana \hfill{16.00 \euro}
    \newline
    \textcolor{red}{Thinly cut grilled steak with rocket salad and parmesan cheese}
    \newline
    Spezzatino di cinghiale e triangoli di polenta fritta \hfill{18.00 \euro}
    \newline
    \textcolor{red}{Wild boar stew with fried polenta}
    \newline
    Trippa alla Fiorentina \hfill{13.00 \euro}
    \newline
    \textcolor{red}{Florence’s traditional tripe}
    \newline
    Spezzatino di manzo con concentrato di melograno, noci e riso pilaf  
    \hfill{18.00 \euro}
    \newline
    \textcolor{red}{Beef stew with pomegranate concentrate, nuts and white rice}
}
   \end{minipage}
   \vspace{.02\textheight}
    \begin{minipage}[c][0.35\textheight][c]{\textwidth}{
    \begin{center}
        \LARGE{ \underline{CONTORNI} \\
            \color{red}{\underline{SIDE DISHES}}}
    \end{center}
    \vspace{.015\textheight}
    Patatine fritte* \raisebox{0ex}{\resizebox{!}{2ex}{\includegraphics{veg.jpg}}}\hfill{4.00 \euro}
    \newline
    \textcolor{red}{French fries*}
    \newline
    Fagioli cannellini\raisebox{0ex}{\resizebox{!}{2ex}{\includegraphics{veg.jpg}}}\hfill{4.00 \euro}
    \newline
    \textcolor{red}{White beans}
    \newline
    Insalata mista con pomodoro \raisebox{0ex}{\resizebox{!}{2ex}{\includegraphics{veg.jpg}}}\hfill{4.50 \euro}
    \newline
    \textcolor{red}{Mixed Salad with tomatoes}
    \newline
    Patate arrosto*\raisebox{0ex}{\resizebox{!}{2ex}{\includegraphics{veg.jpg}}}\hfill{5.00 \euro}
    \newline
    \textcolor{red}{Roasted potatoes}
    \newline
    Verdure lesse\raisebox{0ex}{\resizebox{!}{2ex}{\includegraphics{veg.jpg}}}\hfill{6.00 \euro}
    \newline
    \textcolor{red}{Boiled Vegetables}
    \newline
    Verdure grigliate \raisebox{0ex}{\resizebox{!}{2ex}{\includegraphics{veg.jpg}}}\hfill{6.00 \euro}
    \newline
    \textcolor{red}{Grilled Vegetables}
    \newline
    Insalatona (insalata verde, mozzarella, pomodoro, tonno, olive) \hfill{8.50 \euro}
    \newline
    \textcolor{red}{Special Salad (green salad, mozzarella, tuna, olive, tomato)}
}
\end{minipage}
\begin{minipage}[b][0.1\textheight][b]{\textwidth}{
    COPERT0 2.00 \euro A PERSONA
    \newline
    \textcolor{red}{COVER 2.00 \euro PER PERSON}}
\end{minipage}
 \begin{minipage}[t][0.5\textheight][t]{\textwidth}{
    \begin{center}
        \LARGE{ \underline{BEVANDE} \\
            \color{red}{\underline{DRINKS}}}
    \end{center}
    \vspace{.015\textheight}
Acqua minerale (500 ml) \hfill{1.50 \euro}
\newline
\textcolor{red}{Mineral water (500 ml)}
\newline
Acqua minerale (1000 ml) \hfill{2.50 \euro}
\newline
\textcolor{red}{Mineral water (1000 ml)}
\newline
Succo di Frutta (Arancia-pesca) \hfill{3.00 \euro}
\newline
\textcolor{red}{Fruit juice (orange, peach)}
\newline
Pepsi piccola \hfill{3.00 \euro}
\newline
\textcolor{red}{Small pepsi}
\newline
Pepsi media \hfill{4.00 \euro}
\newline
\textcolor{red}{Medium pepsi}
\newline
Lattine (coca-fanta-sprite-schweppes-chinò) \hfill{3.00 \euro}
\newline
\textcolor{red}{Can (coca-fanta-sprite-schweppes-chinò) }
\newline
Thè bottiglie (500 ml, pesca-limone) \hfill{3.50 \euro}
\newline
\textcolor{red}{Tea bottle (500 ml, peach-lemon)}
\newline
Birra piccola (200 ml) \hfill{3.00 \euro}
\newline
\textcolor{red}{Small draught  beer (200 ml)}
\newline
Birra media (400 ml) \hfill{5.00 \euro}
\newline
\textcolor{red}{Medium draught  beer (400 ml)}
\newline
Birra Heineken (330 ml) \hfill{5.00 \euro}
\newline
Birra Moretti (330 ml) \hfill{5.00 \euro}
\newline
Birra  Beck’s  (330 ml)\hfill{5.00 \euro}
\newline
Corona extra (330 ml)\hfill{5.00 \euro}
\newline
Tenent’s  (330 ml)\hfill{6.00 \euro}
\newline
Birra analcolica\hfill{5.00 \euro}
\newline
\textcolor{red}{Nonalcoholic beer}
}
\end{minipage}
\vfill
\begin{minipage}[b][0.3\textheight][b]{\textwidth}{
    \begin{center}
        \LARGE{ \underline{VINO} \\
            \color{red}{\underline{WINE}}}
    \end{center}
    \vspace{.015\textheight}
Vino della casa (Chianti, 500 ml)\hfill{7.50 \euro}
\newline
\textcolor{red}{Wine of the house (Chianti, 500 ml)}
\newline
Chianti (375 ml)\hfill{9.00 \euro}
\newline
Col di Sasso (375 ml)\hfill{10.00 \euro}
\newline
Le Rime bianco (Chardonnay \& Pinot Grigio) (375 ml)\hfill{10.00 \euro}
\newline
Rosso Montalcino (375ml)\hfill{18.00 \euro}
\newline
Pinot Rosè (750 ml) \hfill{16.00 \euro}
\newline
Prosecco Brut (750 ml)\hfill{17.00 \euro}
\newline
Le Rime bianco (Chardonnay \& Pinot Grigio) (750 ml)\hfill{18.00 \euro}
\newline
Col di Sasso (Gabernet Sauvignon \& Sangiovese) (750 ml)\hfill{18.00 \euro}
\newline
Chianti (750 ml)\hfill{16.00 \euro}
\newline
Rosso Montalcino (750 ml)\hfill{28.00 \euro}
\newline                       
Brunello Montalcino (375 ml)\hfill{28.00 \euro} 
\newline
Brunello Montalcino   (750 ml)  \hfill{48.00 \euro}
\newline
}
\end{minipage}
 \end{document}

答案1

{ }通过删除不必要的括号,您可以消除输入中的大量混乱。

如果您希望页面上的所有内容居中,则可以使用\centering宏。

您不需要将文本放在minipage里面{ }。您也不需要在这里指定 s 的高度minipage。只要让它们任意高即可。您也不需要使用[t][b]—— 可能您认为这会将它们锚定在页面的顶部和底部(但实际上并非如此!)但无论如何,宏\vfill都会填满所有未使用的垂直空间并将第二个推minipage到底部。

但是,如果您使用tabularx环境而不是 minipages,您也​​可以摆脱重复的\hfills、\euros 和\newlines,并大大简化输入。

请注意,@{}格式中的规范tabularx并不是真正必要的,但如果没有它们,表格会稍微窄一些,因为默认情况下表格周围有左右边距。我将它们放入只是为了“精确”地重现您最初输入的内容。

注意,\LARGE文本现在被放在一个{ }组中,以防止大尺寸“泄漏”到文档的其余部分。在原始版本中,\begin(center}\end{center}(使用 后不再需要\centering)就是这个功能。

我在英语和意大利语标题之间添加了一些垂直空间,在我看来这样看起来更好。

就我个人而言,我可能会\newcommand{\UK}[1]{\textcolor{red}{#1}}在序言中写上类似的东西,然后在其余的输入中用“etc”\UK{Mineral water (500 ml)}代替。“不要不必要地重复自己”是一个值得遵循的好原则。\textcolor{red}{Mineral water (500 ml)

\documentclass[12pt,italian]{article}
\usepackage{geometry}
\geometry{a4paper,top=2.5cm,bottom=2cm,left=2cm,right=2cm,bindingoffset=5mm}
\usepackage[utf8x]{inputenc}
\usepackage[italian]{babel}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{fourier}
\usepackage{eurosym}
\usepackage{tabularx}
\pagestyle{empty}
\begin{document}

\centering

{\LARGE{\underline{BEVANDE} \\[4pt]
        \color{red}{\underline{DRINKS}}}}

\vspace{.015\textheight}
\begin{tabularx}{\textwidth}{@{}Xr<{ \euro}@{}}
Acqua minerale (500 ml)                     & 1.50 \\
\textcolor{red}{Mineral water (500 ml)} \\
Acqua minerale (1000 ml)                    & 2.50 \\
\textcolor{red}{Mineral water (1000 ml)} \\
Succo di Frutta (Arancia-pesca)             & 3.00 \\
\textcolor{red}{Fruit juice (orange, peach)} \\
Pepsi piccola                               & 3.00 \\
\textcolor{red}{Small pepsi} \\
Pepsi media                                 & 4.00 \\
\textcolor{red}{Medium pepsi} \\
Lattine (coca-fanta-sprite-schweppes-chinò) & 3.00 \\
\textcolor{red}{Can (coca-fanta-sprite-schweppes-chinò)} \\
Thè bottiglie (500 ml, pesca-limone)        & 3.50 \\
\textcolor{red}{Tea bottle (500 ml, peach-lemon)} \\
Birra piccola (200 ml)                      & 3.00 \\
\textcolor{red}{Small draught  beer (200 ml)} \\
Birra media (400 ml)                        & 5.00 \\
\textcolor{red}{Medium draught  beer (400 ml)} \\
Birra Heineken (330 ml)                     & 5.00 \\
Birra Moretti (330 ml)                      & 5.00 \\
Birra  Beck’s  (330 ml)                     & 5.00 \\
Corona extra (330 ml)                       & 5.00 \\
Tenent’s  (330 ml)                          & 6.00 \\
Birra analcolica                            & 5.00 \\
\textcolor{red}{Nonalcoholic beer}
\end{tabularx}

\vfill
{\LARGE{\underline{VINO} \\[4pt]
        \color{red}{\underline{WINE}}}}

\vspace{.015\textheight}
\begin{tabularx}{\textwidth}{@{}Xr<{ \euro}@{}}
Vino della casa (Chianti, 500 ml)                        & 7.50 \\
\textcolor{red}{Wine of the house (Chianti, 500 ml)} \\
Chianti (375 ml)                                         & 9.00 \\
Col di Sasso (375 ml)                                    & 10.00 \\
Le Rime bianco (Chardonnay \& Pinot Grigio) (375 ml)     & 10.00 \\
Rosso Montalcino (375ml)                                 & 18.00 \\
Pinot Rosè (750 ml)                                      & 16.00 \\
Prosecco Brut (750 ml)                                   & 17.00 \\
Le Rime bianco (Chardonnay \& Pinot Grigio) (750 ml)     & 18.00 \\
Col di Sasso (Gabernet Sauvignon \& Sangiovese) (750 ml) & 18.00 \\
Chianti (750 ml)                                         & 16.00 \\
Rosso Montalcino (750 ml)                                & 28.00 \\
Brunello Montalcino (375 ml)                             & 28.00 \\
Brunello Montalcino (750 ml)                             & 48.00
\end{tabularx}
\end{document}

答案2

我不完全确定你的意思,因为当我尝试你的代码时我得到了这个输出:

左边距都相同

所有左边距均相同。

如果您遇到的问题是左边距大于右边距,那是因为当小页面位于新段落中时,它们作为一个整体会缩进(并且如果您\vfill在代码中省略了第二个小页面“Wine”,则不会将其视为开始新段落并且不会缩进)。

如果这确实是您的意思,那么我建议在小页面之前使用,或者在序言中将\noindent整个文档的缩进设置为 0 。\setlength{\parindent}{0pt}

您的文档在没有缩进的情况下如下所示:

无缩进的菜单

相关内容