Hi and welcome,
expansion is a tricky thing in TeX, very tricky. To be honest, i don't have the knowledge of the lower level stuff. But on the level you are currently working, you should be fine.
But please remember that there are environments as well. Don't put everything in macros, enclose it in an environment. Some macros cannot process arguments which are long, i.e. containing a paragraph (an empty line).
If using LaTeX3 syntax is offputting right now for you, which is perfectly understandable, at least use LaTeX2e syntax. You are using a mix of TeX and LaTeX2.09 (which went obsolete 20 years ago).
The more time and effort you spend on designing a solid userinterface, the less probable is the chance of breaking later on. I suppose the text could be a bit longer, so i used an environment here. Advantage, you could later redefine the environment to use a frame more easy.
Code: Select all
\begin{filecontents}{\jobname.sty}
\newlength{\areaone@Pretitle}
\setlength{\areaone@Pretitle}{1ex}
\newcommand{\areaonePostTitle}{}
\newkomafont{areaonefont}{\normalfont\bfseries\color{red}}
\newenvironment{areaone}{\par%Just to be sure
\vspace{\areaone@Pretitle}%
\noindent{\usekomafont{areaonefont}This is Areaone\par}%
\areaonePostTitle
}{\par}
\end{filecontents}
\documentclass{article}
\usepackage{scrextend}
\usepackage{xcolor}
\usepackage{csquotes}
\usepackage{\jobname}
\usepackage{mdframed}
\newcommand{\Enterareaone}[1]
{
\vskip 7pt
{{\bf {\color{red} This is Areaone}} \\}
{#1\\}
}
\begin{document}
\Enterareaone
{
This is the text that is written below the title of the area
which is ''This is Areaone''
}
\rule{.5\textwidth}{.4pt}
\begin{areaone}
This is the text that is written below the title of the area
which is \enquote{This is Areaone}
\end{areaone}
\addtokomafont{areaonefont}{\itshape}
\surroundwithmdframed{areaone}
\begin{areaone}
This is the text that is written below the title of the area
which is \enquote{This is Areaone}
\end{areaone}
\makeatletter
\setlength{\areaone@Pretitle}{3ex}
\makeatother
\renewcommand{\areaonePostTitle}{\noindent\rule{\textwidth}{.4pt}\par}
\begin{areaone}
This is the text that is written below the title of the area
which is \enquote{This is Areaone}
\end{areaone}
\end{document}
Please take special care of non protected line endings, they all produce spaces, mostly at places where you don't want them.
\\
are linebreaks and have nothing to do with paragraphs. A double backslash in normal text should always be a warning sign and lead to suspicion. Use a blank line, or
\par
in your definitions. What is the difference? Since LaTeX (TeX) works with paragraphs, it gets confused seeing only one reaaaaally big paragraph.
Macros can be used solely to save some time typing, if you notice that is the reason for you doing it, stop right there. This
will go bad. But defining many little helper macros to ensure a consistent outcome for everybody contributing, and/or providing hooks (in form of helper macros) to easily adjust the output. Like above, there is an easy interface to change the font of the title (or whatever the red thing is). You could also, instead of setting a fixed length, use LaTeX lengths.
The standard classes, which are based on code by Leslie from the eighties defined stuff the fixed way (just like you did). This is one reason why so many packages were developed that provided hooks to easily adjust to ones personal taste.
On the other hand, there are classes like
memoir
or the
KOMA
-classes that are going the approach i am using above. Look ahead, where could the user want to make changes? Where am i allowing the user to do changes?
I once again changed the above code, hiding the definition of the environment in a small little package. Back to allowing the user stuff: To change the length
\areaone@Pretitle
the user has to do some extra stuff that warns him: be careful, you are messing around with internal stuff.
Where can stuff break? Think about captions, their argument is usually processed right with the object and once again in the list of objects. Fragile commands are breaking (hence the name) so you have to take care there.
If you have further questions, feel free to ask.

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.