3

How to align right every new line which I made using \ in parbox?

I've used parbox in latex for creating different part in latex business card. On the left side I've used parbox and it is automatically left aligned.

How to create parbox on the right side of business card and align them right?

This is my latex code:

\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 Answer 1

3

You could use \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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .