Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm working on my CV, and am trying to format job/education listings to look something like follows:

Company or University (Location)
Job title or degree received
Some description of what I did there.

I'm putting enough of these in that I'd like to define an environment to handle the formatting so I don't have to hard-code it (and/or have to re-do every single one individually when I change my mind!). I.e. I'd like to be able to do something like

\begin{job}
\institution{Company or University}
\location{Location}
\position{Job title or degree received}
\description{Some description of what I did there.}
\end{job}

And have it output the above. I kind of blindly tried to define new commands for \institution, \location, \position, etc. using e.g.

\def\institution#1{\gdef{\@institution}{#1}}

and then create a new environment that does the formatting in the "after environment" code, like so:

\newenvironment{job}{}{\textbf{\@institution}}

I put both of these inside a \makeatletter...\makeatother block, and my document compiles fine with this in the preamble. But as soon as I try to actually use this environment, e.g. insert

\begin{job}
\institution{Someplace I worked}
\end{job}

somewhere in the document body, I get an error that says

Missing control sequence inserted: <inserted text> 
\inaccessible

when it reads the \institution{Someplace I worked} line and a second that says

Undefined control sequence: <recently read> \@institution

when it reads the \end{job} line.

So, clearly my naive approach doesn't work - any better ways to go about this?

share|improve this question
2  
\gdef{\@institution}{#1} is a syntax error you can not put braces around the command being defined with the primitive def syntax. \gdef\@institution{#1}} –  David Carlisle Aug 10 '12 at 18:54
    
Also, there is no need to define those commands as global. It might be a better idea to define local commands in the "begin" portion of \newenvironment –  mrf Aug 10 '12 at 21:49
    
Ah! Thanks, @david-carlisle - the syntax error was the culprit. It worked once I fixed that. –  Jennifer L Aug 10 '12 at 22:44
    
@JenniferL Is it OK for you if we close this question since it seems that you have fixed the issue? –  percusse Aug 10 '12 at 23:01
    
Yes - I was just about to update the question with the solution, but it's fine to close it. Thanks for the help! –  Jennifer L Aug 10 '12 at 23:09
add comment

closed as too localized by Marco Daniel, Joseph Wright Aug 11 '12 at 9:10

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

Here's a couple of ideas- one is using a \newcommand, and one uses a \newenvironment; perhaps you can tweak them as you see fit

screenshot

Code:

\documentclass{article}

% as a command
\newcommand{\job}[4]{% 1: company, 2: location, 3: title, 4: description
    \noindent\begin{tabular}{@{}l}%
    \bfseries{#1 (#2)}\\
    \itshape{#3}\\
    #4
    \end{tabular}%
}

% or perhaps an environment
\newenvironment{myjob}[3]{% 1: company, 2: location, 3: title
    \noindent\begin{tabular}{@{}p{\textwidth}@{}}%
    \bfseries{#1 (#2)}\\
    \itshape{#3}\\
        }%
    {%
    \end{tabular}%
    }

\begin{document}

\job{Company or University}%
    {Location}%
    {Job title or degree received}%
    {Some description of what I did there.}

\begin{myjob}{Another institution}%
    {Somewhere else}%
    {Another thing}%
    Long description of stuff| could be anything
    \begin{itemize}
        \item discovered
        \item a 
        \item few
        \item important
        \item things
    \end{itemize}
\end{myjob}

\end{document}
share|improve this answer
add comment

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