0

I would like to create badges in Latex. I want to place the badges on the paper next to each other, so I have to cut the paper only once! I have the following code:

\documentclass[a4paper,12pt]{article}
\usepackage{fullpage}
\usepackage{filecontents}
\usepackage{csvtools}
\usepackage{graphicx}
\usepackage{fix-cm}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\pagestyle{empty}

\begin{document}

\setcsvseparator{;}

\applyCSVfile{kimaradt.csv}{%
     \noindent
        \hspace{-2mm}
        \vspace{-0.2mm}
        \fbox{\begin{minipage}[t][52mm]{87mm}
            \vspace{10mm}

            \sffamily \centering
                \fontsize{22}{26}\selectfont\textbf\insertName
                \LARGE \vspace{5mm}

                \itshape\insertAffiliation
                \vspace{1mm}

                \begin{minipage}[b]{4.8cm}
                    \begin{center}
                    \footnotesize
                    International Conference\\ 
                    2019
                    \end{center}
                \end{minipage}

            \end{minipage}}
}

\end{document}

and the corresponding CSV file is this:

Name;Affiliation
John Smith; UK
Jack Black; UK
John Smith; UK
Jack Black; UK
John Smith; UK
Jack Black; UK
John Smith; UK
Jack Black; UK
John Smith; UK
Jack Black; UK
John Smith; UK
Jack Black; UK
John Smith; UK
Jack Black; UK
John Smith; UK
Jack Black; UK

My problem is that the first line of badges are placed differently on the first page then all the other badges, on all other pages. So my questions:

  • How can I solve this problem? Where is that space (negative indentation) coming from?

My general question is:

  • How can I debug, find these kind of problems? Is there a way or technique or package for this?
  • csvtools is marked as obsolete in CTAN – egreg Jan 28 at 11:08
  • What other package is recommended instead of csvtools? What other package can read in a csv file? – Peter Ivanyi Jan 28 at 12:09
1

An \mbox{}% before the first \hspace{..} would let the horizontal spacing take effect. Otherwise it gets absorbed at the beginning of a paragraph.

\documentclass[a4paper,12pt]{article}
\usepackage{fullpage}
\usepackage{filecontents}
\usepackage{csvtools}
\usepackage{graphicx}
\usepackage{fix-cm}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\pagestyle{empty}

\begin{document}

\setcsvseparator{;}

\applyCSVfile{kimaradt.csv}{%
         \noindent
                \mbox{}%  add this to let the first \hspace take effect
                \hspace{-2mm}
                \vspace{-0.2mm}
                \fbox{\begin{minipage}[t][52mm]{87mm}
                        \vspace{10mm}

                        \sffamily \centering
                                \fontsize{22}{26}\selectfont\textbf\insertName
                                \LARGE \vspace{5mm}

                                \itshape\insertAffiliation
                                \vspace{1mm}

                                \begin{minipage}[b]{4.8cm}
                                        \begin{center}
                                        \footnotesize
                                        International Conference\\ 
                                        2019
                                        \end{center}
                                \end{minipage}

                        \end{minipage}}
}

\end{document}

which gives this transformation:

enter image description here

  1. For your second question, the general answer is: you need to know in more depth the logic through which each command takes effect. However, I guess, the time needed to do this is infinite (or, better phrased, one human life is probably not sufficient to grasp all that). And a particular answer could be: to go through some moderate to advanced LaTeX documentation, one among them being The LaTeX Companion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.