0

Paragraph not indenting properly. enter image description here

Here is the code I'm using

\documentclass[a4paper,10pt]{article}
%-----------------------------------------------------------
\usepackage{geometry}
\usepackage{url}
\fontfamily{SansSerif}
\selectfont

\usepackage[T1]{fontenc}
\usepackage{color}
\definecolor{mygrey}{gray}{0.75}
\textheight=9.75in
\raggedbottom

\setlength{\tabcolsep}{0in}
\newcommand{\lsep}{-0.5cm}
\renewcommand{\labelitemii}{$\circ$}

\pagestyle{empty}
%-----------------------------------------------------------
%Custom commands
\newcommand{\resheading}[1]{{\small \colorbox{mygrey}{\begin{minipage}{0.975\textwidth}{\textbf{#1 \vphantom{p\^{E}}}}\end{minipage}}}}
%-----------------------------------------------------------

\begin{document}

\resheading{\textbf{OBJECTIVE} }\\[\lsep]
\\ \\
\indent
To secure a position where Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah.    
\end{document}

Can anybody tell me whats the problem

Atinesh
  • 254
  • 2
    Maybe the problem is that the OBJECTIVE line is indented? Add a \noindent to your \newcommand like this \newcommand{\resheading}[1]{{\small \noindent \colorbox{... – James Jun 19 '15 at 12:53
  • The paragraph is indenting as it should. Perhaps you should rephrase your question so it is more obvious what you are asking. – daleif Jun 19 '15 at 12:57
  • @james indentation in heading "OBJECTIVE" is correct, I need that indentation in my actual document. Can you tell me how to indent the paragraph below the heading – Atinesh Jun 19 '15 at 13:32
  • 2
    The command \resheading is very poorly designed, as is evidenced by your attempt to "correct" it afterwards by adding the \\[lsep] \\ \\ \indent afterwards. If it were properly constructed, you whould only need to write \resheading{OBJECTIVE} and then continue on with the text To secure a position.... If you add \usepackage[showframe]{geometry}, you will see that both the line with "OBJECTIVE" and the line below it are indented; the subsequent lines are flush left to the left margin of the document. Do you mean you want the 1st line starting "To secure" to be "double indented"? – jon Jun 19 '15 at 13:42
  • 1
    So: please describe in words and/or pictures what the actual output should look like in comparison to regular text above and below your OBJECTIVE line. – jon Jun 19 '15 at 13:43
  • @jon Please see the following picture http://s2.postimg.org/ia7qog87t/Capture.png – Atinesh Jun 19 '15 at 13:58
  • 2
    According to that image it seems you don't want to indent the heading "OBJECTIVE". – Paul Stiverson Jun 19 '15 at 13:59
  • You are not providing your image in context. Please put your existing image in between regular text (i.e., text that goes from the document's left margin to its right margin). Your comment to @LaRiFaRi suggests that this whole thing you're describing is actually an environment, not a heading + regular text... – jon Jun 19 '15 at 14:34
  • @PaulStiverson See the below Image you will understand why I need to indent "Objective"

    http://s12.postimg.org/5a6s36k6l/Capture.png

    If I don't indent then "Objective" will displace littlebit to left. I 've to keep it in centre.

    – Atinesh Jun 19 '15 at 14:34
  • @Atinesh You last comment with the image is essential, it should have been in the very first question. – Johannes_B Jun 19 '15 at 14:38
  • Johannes_B Ya Sorry – Atinesh Jun 19 '15 at 14:41
  • Repost that last image, but use \usepackage[showframe]{geometry}. It will then be clear how all the elements are related to one another. – jon Jun 19 '15 at 14:42
  • It seems you could adjust the left margin to achieve your goal without futzing with indentation at all. – Paul Stiverson Jun 19 '15 at 14:56

1 Answers1

4

Just add the command \noindent in to your macro.

% arara: pdflatex

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage{lmodern} % load this whith [T1]{fontenc}
\usepackage{xcolor}
\definecolor{mygrey}{gray}{0.75}
\pagestyle{empty}
\newcommand{\resheading}[1]{{\noindent\small\colorbox{mygrey}{\begin{minipage}{0.975\textwidth}{\textbf{#1\vphantom{p\^{E}}}}\end{minipage}}}\bigskip}

\begin{document}    
    \resheading{\textbf{OBJECTIVE}}

    To secure a position where Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah. Blah.    
\end{document}

LaRiFaRi
  • 43,807
  • Can not use \noindent in \resheading as I have to maintain spaces left and right to the heading and paragrapgh. See the below image

    http://s12.postimg.org/5a6s36k6l/Capture.png

    If I use code as you have mentioned above, the heading and the paragrapgh gets displaced left littlebit, but it should be in centre.

    – Atinesh Jun 19 '15 at 14:31
  • @Atinesh, you are still not being particularly clear on what exactly it is you want. How should be gray box behave? How should the title inside the box behave? – daleif Jun 19 '15 at 14:39
  • I want "Objective" Heading to be intact, As the indentation that is used in it is used to keep it in centre. What I want is just to move the paragraph below the heading to some position right. – Atinesh Jun 19 '15 at 14:44
  • @Atinesh -- I'm sorry, but using indentation to "keep it in the centre" is a bad idea. You should use "centering"-related commands for that. But, more importantly, I think you might be confused about how the margins and textblock are set up. – jon Jun 19 '15 at 15:05