0

I have learned from the following questions:

I was trying to pass an ancestries list as an array with a new command or a definition or a new command with a definition as an array to the same new command or the same definition.

Here is the small code:

\documentclass{standalone}
\usepackage{graphicx}
\usepackage{pgffor}
\usepackage{svg}
\usepackage[all]{genealogytree}
\newlength{\mypx}
\setlength{\mypx}{0.013889in}

\newcommand\Ancestries[1] { \def\ancestrieslist{#1} \foreach \ancestry in \ancestrieslist { \includesvg[width={10\mypx}]{assets/images/flags/twemoji/\ancestry.svg}\par } }

\begin{document}

\linespread{1.5}
\begin{tikzpicture}
    \genealogytree
    {
        parent
        {
            g[id = 01, male, box = {title = Self}]
            {
                \textbf{Ancestries}\\
                \Ancestries{argentina, brazil, italy, portugal, spain}\\
            }
        }
    }
\end{tikzpicture}

\end{document}

I also tried two other ways:

\newcommand{\Ancestries}[1]
{
    \foreach \x in {#1} 
    {%
        \includesvg[width={10\mypx}]{assets/images/flags/twemoji/\x.svg}\par%
    }
}

\def\Ancestries#1 {% \foreach \x in {#1} {% \includesvg[width={10\mypx}]{assets/images/flags/twemoji/\x.svg}\par% } }

The result should look like:

\textbf{Ancestries}\\
\includesvg[width={10\mypx}]{assets/images/flags/twemoji/argentina.svg}
\includesvg[width={10\mypx}]{assets/images/flags/twemoji/brazil.svg}
\includesvg[width={10\mypx}]{assets/images/flags/twemoji/italy.svg}
\includesvg[width={10\mypx}]{assets/images/flags/twemoji/portugal.svg}
\includesvg[width={10\mypx}]{assets/images/flags/twemoji/spain.svg}

Small log here:

No file minha-genealogia-completa-01.aux.
(/usr/share/texmf-dist/tex/latex/base/ts1cmr.fd) (|'inkscape' -V ) (./svg-inkscape/argentina_svg-tex.pdf_tex) (./svg-inkscape/brazil_svg-tex.pdf_tex) (./svg-inkscape/italy_svg-tex.pdf_tex) (./svg-inkscape/portugal_svg-tex.pdf_tex) (./svg-inkscape/spain_svg-tex.pdf_tex)

/home/Ooo/minha-genealogia-completa-01.tex:113: LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...

l.113 ^^I^^I}

No pages of output.

Oo'-
  • 269
  • What exactly is your problem? Please note that no one except you can run your code it seems, because we don't have access to your assets/images/flags/twemoji/ folder. – Skillmon Oct 30 '23 at 15:36
  • I put the log here. – Oo'- Nov 01 '23 at 17:04
  • Follow the zipped file link: https://file.io/7Wap9bDziC7j – Oo'- Nov 01 '23 at 17:08
  • 1
    If you put a \par at the end of each of your entries you can't put a \\ after your \Ancestries, because then you'd do \par\\ and that throws the error in your question. Just remove the \\ and you should be good to go. – Skillmon Nov 01 '23 at 18:37

1 Answers1

1

The error

LaTeX Error: There's no line here to end.

is usually thrown if you use \\ in vertical mode. In your case it is caused by the \\ after \Ancestries{argentina, brazil, italy, portugal, spain}, because after each entry in \Ancestries you put a \par, so this essentially leads to \par\\, and then you're greeted with that error.

The following compiles:

\documentclass{standalone}
\usepackage{graphicx}
\usepackage{pgffor}
\usepackage{svg}
\usepackage[all]{genealogytree}
\newlength{\mypx}
\setlength{\mypx}{0.013889in}

\newcommand\Ancestries[1] {% \foreach \ancestry in {#1}% {% \rule{10\mypx}{10\mypx}\par %\includesvg[width={10\mypx}]{assets/images/flags/twemoji/\ancestry.svg}\par }% }

\begin{document}

\linespread{1.5}
\begin{tikzpicture}
    \genealogytree
    {
        parent
        {
            g[id = 01, male, box = {title = Self}]
            {
                \textbf{Ancestries}\\
                \Ancestries{argentina, brazil, italy, portugal, spain}
            }
        }
    }
\end{tikzpicture}

\end{document}

Skillmon
  • 60,462