如何使我在 parbox 中使用 \ 创建的每一条新行都右对齐?
我使用 latex 中的 parbox 创建 latex 名片中的不同部分。在左侧我使用了 parbox,它会自动左对齐。
如何在名片右侧创建 parbox 并使其正确对齐?
这是我的乳胶代码:
\documentclass[a4paper,11]{article}
\usepackage[utf8]{inputenc}
\usepackage[zw32010,crossmark]{ticket}
\usepackage{graphicx}
\usepackage[paperwidth=80mm, paperheight=50mm]{geometry}
\newcommand*{\myfont}{\fontfamily{\sfdefault}\selectfont}
\renewcommand{\ticketdefault}{}
\newcommand{\vcard}[5]{\ticket{
\put(40, 25){\tt \LARGE #1}
\put(4, 10){\tt #2}
\put(52, 10){\tt #3}
}}
\newcounter{numcards}
\begin{document}
\setcounter{numcards}{0}
\whiledo{\thenumcards<1}{
\stepcounter{numcards}
\vcard
{\includegraphics[width=40mm]{logo}}
{\parbox{\textwidth}{\scriptsize \myfont{Comapny LTD \\Company address \\ 11000 Belgrade, Serbia \\www.company.com}}}
{\parbox{\textwidth}{\scriptsize \myfont{M: +381 (0)11 22 33 444\\ T: +381 (0)11 22 33 445\\ F: +381 (0)11 22 33 446 \\ [email protected]}}}
}
\end{document}
答案1
您可以使用\raggedleft
:
\documentclass[a4paper,11]{article}
\usepackage[utf8]{inputenc}
\usepackage[zw32010,crossmark]{ticket}
\usepackage{graphicx}
\usepackage[paperwidth=80mm, paperheight=50mm]{geometry}
\newcommand*{\myfont}{\fontfamily{\sfdefault}\selectfont}
\renewcommand{\ticketdefault}{}
\newcommand{\vcard}[5]{\ticket{
\put(40, 25){\tt \LARGE #1}
\put(4, 10){\tt #2}
\put(52, 10){\tt #3}
}}
\newcounter{numcards}
\begin{document}
\setcounter{numcards}{0}
\whiledo{\thenumcards<1}{
\stepcounter{numcards}
\vcard
{\includegraphics[width=40mm]{example-image}}
{\parbox{\textwidth}{\scriptsize \myfont{Company LTD \\Company address \\ 11000 Belgrade, Serbia \\www.company.com}}}
{\parbox{.5\textwidth}{\scriptsize\raggedleft \myfont{M: +381 (0)11 22 33 444\\ T: +381 (0)11 22 33 445\\ F: +381 (0)11 22 33 446 \\ [email protected]}}}
}
\end{document}