How to override LaTeX template's string constants - latex

I'm typesetting my CV using the europecv LaTeX class. I don't actually need to conform to the EU's standardized CV form, but I like the general layout of it. One thing that bothers me about the class is how it sets certain headings, for instance
Surname(s) / First name(s): Smith, John
Where I'd rather have
Name: John Smith
I've found that these string constants for English are defined in a file called "ecven.def" thus:
\def\ecv#infosectionkey{\ecv#utf{Personal information}}
\def\ecv#namekey{\ecv#utf{Surname(s) / First name(s)}}
\def\ecv#addresskey{\ecv#utf{Address(es)}}
\def\ecv#telkey{\ecv#utf{Telephone(s)}}
\def\ecv#mobilekey{\ecv#utf{Mobile}}
I guess I could just edit this file to change them, but that seems like the wrong approach. I tried to do this at the top of my document:
\renewcommand{\ecv#namekey}{\ecv#utf{Name}}
which gives this error:
./eurocv.tex:22: LaTeX Error: Missing \begin{document}.
And I've tried this:
\def\ecv#namekey{\ecv#utf{Name}}
which doesn't give an error, but doesn't change the output. Any ideas?

You need to use the \makeatletter and \makeatother commands wrapping your changes.
\makeatletter
\def\ecv#namekey{\ecv#utf{Name}}
...
\makeatother

Related

latex todonotes-package throws error in combination with ieeeojies.cls document class

When I am trying to use the todonotes-package within the IEEE OJIES template, by just adding \usepackage{todonotes}, latex throws a “Missing number, treated as zero.” error.
It seems to me that something is in conflict with things in the ieeeojies.cls class-file. If I use the IEEEtran.cls as a document class, no error is thrown.
Here is the link to the template in overleaf:
https://www.overleaf.com/latex/templates/ieee-open-journal-of-the-industrial-electronics-society-template/nhkhktxkdsgf
I am used to work with the todonotes-package, so can please somebody with more latex experience help me out here?
The problem is the naughty redefinition of \year in the class.
You can avoid the error by loading pgf before the class so it still gets to see the correct definition of year instead of the strange things the class does to it
\RequirePackage{pgf}
\documentclass{ieeeojies}
\usepackage{todonotes}
\begin{document}
\EOD
\end{document}

How to create a LaTeX class with default parameters?

I've learnt how to use LaTeX at the user level, but wanted to package the recurring code (resulting mostly from the styling of the cover) in a class file.
Therefore, I tried the following simple example class file:
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{test}[2018/10/12 v0.1 Test class]
\PassOptionsToClass{12pt}{report}
\ProcessOptions
\LoadClassWithOptions{report}
Although this works if I pass the size I want, if I omit it, it defaults to 10pt, instead of 12pt that I want. Do you know how to make the default become the 12pt, and still work if I decide to give it another size option?
Based on https://tex.stackexchange.com/a/123623/36296 you could so something like
\RequirePackage{filecontents}
\begin{filecontents}{test.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{test}[2018/10/12 v0.1 Test class]
\DeclareOption{10pt}{\def\test#ptsize{10pt}}
\DeclareOption{11pt}{\def\test#ptsize{11pt}}
\DeclareOption{12pt}{\def\test#ptsize{12pt}}
\ExecuteOptions{12pt}
\ProcessOptions
\PassOptionsToClass{\test#ptsize}{report}
\LoadClass{report}
\end{filecontents}
\documentclass{test}
\begin{document}
test
\end{document}

LaTeX: Cite, but don't reference

I'm producing a set of documents in LaTeX, and I would like to provide a single, global bibliography page for the whole set. This is because each document is page-limited: I don't want to take up space with references at the bottom of each one.
This means in each case, I would like to cite in the text, but not produce a reference at the end. I am using bibtex/natbib to handle the referencing.
Simplest example:
\documentclass[]{article}
\bibliographystyle{/usr/share/texmf/bibtex/bst/natbib/plainnat.bst}
\usepackage{natbib}
\begin{document}
In \citet*{MEF2010} I described the method.
\bibliography{bibliography.bib}
\end{document}
How can I do this? Essentially I just want it to cite correctly:
In Bloggs, Blagg and Blog (2010) I described the method.
But not add a references section at the end. Any ideas?
Thanks,
David
Instead of using \bibliography{bibliography.bib} you can try \nobibliography{bibliography.bib}.
You still need to enter the path so it can make the cross-references.
It happens due to missing packages. If you want to resolve the problem then enable the automatic installation packet. After that,First, you run the BibTeX file and generate the Pdf file (instead of pdfLatex file) and then pdfLatex to Pdf

How do I create a command like \title in LaTeX?

I am writing a document class for LaTeX and I want it to be generic. In this document class I redefine the \maketitle command to display a custom title page, and here I want to display some information, like the title, author, etc., but also some other informations. Here is how I display the title:
{\LARGE{\bf \#title}}\\
I'd like to create a new command that works similarly to \title or \author, how can I do that?
If you look at latex.ltx you can see that \title is defined as follows:
\def\title#1{\gdef\#title{#1}}
\def\#title{\#latex#error{No \noexpand\title given}\#ehc}
Those are low-level TeX commands. \title is a command that redefines \#title to expand to the argument given to \title. In more modern LaTeX commands your own definition could look like this:
\newcommand\foo[1]{\renewcommand\#foo{#1}}
\newcommand\#foo{\#latex#error{No \noexpand\foo given}\#ehc}
It's better to use \PackageError or \ClassError to show the error message. Or, if you want \foo to be optional and be empty by default:
\newcommand\foo[1]{\renewcommand\#foo{#1}}
\newcommand\#foo{}
If this is not inside a package, you'll have to put it between \makeatletter and \makeatother because of the # signs.
Here is a sample command I used in my thesis.cls class. It defines a new command \university that works as the \title or \author commands with a default value equals to "no university". If I don't use the \university command in my preamble the default value will be used instead.
\def\#university{no university}
\newcommand{\university}[1]{
\def\#university{#1}
}
Then, in the \maketitle command you can have something like:
\newcommand{\maketitle}{
{\LARGE{\bf \#title}}\\
{\small{\#university}}\\
}

Special names in Latex

In my english thesis latex file, how to mention the following non English words: François, École Fédérale?
Thanks and regards!
The traditional way is to use the accent-adding macros:
Fran\c{c}ois
\'Ecole F\'ed\'erale
(You can also write Fran\c{}cois or Fran\c cois; the \c macro uses no parameter; the braces or space are just a trick to allow LaTeX to see the proper macro name.)
Otherwise, try this:
\usepackage[utf8]{inputenc}
and type the accents directly, with UTF-8 encoding.
There are a host of more-or-less subtle issues with fonts and hyphenation.
If you don't go the UTF8 inputenc route, and yet find yourself writing a lot of these names, I'd suggest defining macros for them. At the simplest, you can say \newcommand\Francois{Fran\c cois} but then you need to be sure to use it as such: \Francois{} so that any spaces afterwards don't get gobbled.
On the other hand, the following technique works pretty well too (though I can't take credit for inventing it - I saw it originally in a short talk at BachoTeX 2009 by Philip Taylor):
\makeatletter
\let\latex#less<
\catcode`<13
\def<{\ifmmode\latex#less\else\expandafter\find#name\fi}
\def\find#name#1>{\#nameuse{name.#1}}
\def\DefineName#1#2{\#namedef{name.#1}{#2}}
\makeatother
Now you can define special names using, e.g.
\DefineName{Francois}{Fran\c cois}
\DefineName{Ecole Federale}{\'Ecole F\'ed\'erale}
and later on you can use them in text with
I ran into <Francois> at the <Ecole Federale> the other day.
You can make your tags (the plain ASCII versions) be whatever you want - they don't have to actually be related to the properly accented names.
EDIT: in response to the issue that misspelled names don't produce errors, you can change the definition of \find#name to
\def\find#name#1>{\ifcsname name.#1\endcsname
\#nameuse{name.#1}%
\else
\#latex#warning{Undefined name #1}%
\fi}
Note that \#latex#warning{...} can be changed to \#latex#error{...}\#eha and it will complain more forcefully. Or if you want to pretend to be (or actually be) a package you can use \Package(Warning|Error){<package name>} in place of \#latex#(warning|error) and it won't pretend to be a built-in LaTeX error anymore.

Resources