0

I tried to use \newcommand{\faculty}[1]{\gdef\@faculty{#1}} to have others use my template for thesis and just change text in the brackets \faculty{Fakulta strojní} and it changes every faculty name in the document, e.g. in titlepage. It does work until I add more commands, like \department etc. Then it tells me Use of \@ doesn't match its definition. and shows Faculty without F. I am using subfiles package and preamble.tex.

\begin{titlepage}
    \centering
        \large\textsc{{VŠB - Technická univerzita Ostrava\\
        \@faculty\\
        \@department}}
        
        \vfill
        
        {\LARGE{\sffamily{\textbf{Název práce}\\
        Title name}}}\\
        
        \vfill
        \normalsize{
        \begin{tabularx}{.8\textwidth}{XX}
        Autor: & autor\\
        Vedoucí disertační práce: & director
    \end{tabularx}\\
        \vspace{2em}
    Ostrava~2021}\
\end{titlepage}
\documentclass[a4paper, 12pt]{scrartcl}
\input{nastaveni/preamble}
\usepackage{xr}
\usepackage{subfiles}
    \externaldocument[M-]{\subfix{main}}
\usepackage{graphicx}

\faculty{Fakulta strojní}
\department{Katedra energetiky}

\begin{document}

enter image description here

5
  • Don't you need to put \makeatletter and \makeatother?
    – user226564
    Dec 16, 2020 at 19:22
  • 1
    unrelated but size commands do not take an argument so \normalsize{..} should be \normalsize ..., \LARGE{..} should be \LARGE ... etc Dec 16, 2020 at 19:24
  • @JairoA.delRio Where exactly?:) Dec 16, 2020 at 19:24
  • @DavidCarlisle deleted brackets, no change... Dec 16, 2020 at 19:26
  • @JanOpletal yes exactly: they are doing nothing. Dec 16, 2020 at 19:30

1 Answer 1

2

You are using commands that involve @ which is a reserved character for use within class and package files. Since you are using \input to input the commands instead of putting them into a proper package, then you need to wrap the \input command with \makeatletter and \makeatother.

\documentclass[a4paper, 12pt]{scrartcl}
\makeatletter
\input{nastaveni/preamble}
\makeatother
\usepackage{xr}
\usepackage{subfiles}
    \externaldocument[M-]{\subfix{main}}
\usepackage{graphicx}

\faculty{Fakulta strojní}
\department{Katedra energetiky}

\begin{document}

See the following questions for more details:

3
  • When I added that it changed to this: it prints faculty and department but not Fakulta strojní and Katedra energetiky as it was meant. Dec 16, 2020 at 19:33
  • @JanOpletal: Did you place the \makeatletter...\makeatother pair outside of the titlepage environment, or inside?
    – Werner
    Dec 16, 2020 at 19:35
  • Thank you, I made a mistake when using titlepage as subfile and not printing by \maketitle, and defining titlepage in preamble. Now it works :) Dec 16, 2020 at 19:45

You must log in to answer this question.

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