Imitate Email-reply layout: Vertical line in left margin, except for responses












10















Edit: I am not happy with the 3 answers my first, smaller bounty got me. So I rewrote the question to set clear rules and a proper bounty.





The solution should create two environments, originalemail and response with the following effects:




  • Text in the originalemail is typeset in a way that slightly (4pt) indents all text and adds a vertical line on the left.

  • The response environment can only be used inside the environment and results in the vertical line being broken and the text being aligned on the left without the originalemails indentation. What is more, the response has to be aligned to the same margin on the left, irrespective of where in the originalemail it is placed (e.g., be within a (nested) itemize or enumerate).


Summary




  • leave the layout of the original email in-tact (it should be possible to use sections, lists, paragraphs, floats, etc. as if it as was a plain TeX document and there were no responses and the numbering should be the same with and without respones)

  • using these environments should require no editing of the code outside the response environment. In particular any suspension or resume of enumerate or itemize environments, if required by the solution should be automatic.

  • The only way in which the original layout should change is that it show vertical line (2pt) on the left margin and ideally a slight indentation (4pt).

  • responses and the fragments of the original email have to break pages as normal. (if you use parbox for the responses they wont)

  • allow to insert replys anywhere in the the original text

  • bonus if the solution is nesteable (i.e. the outer originalemail contains an older originalemail and responses)


Rules: for the bounty, you're free to build on the existing answers, i.e. @marmot's/Gonzalo Medina's TikZ approach to draw the line in the left margin, @Vinccool96's tcolorbox or my own rudimentary approach to automatically suspending and resuming lists.



Screenshot from Gmail that roughly summarizes what I need:
enter image description here










share|improve this question

















This question has an open bounty worth +500
reputation from sheß ending in 5 days.


This question has not received enough attention.


The bounty winner should address all the points raised in the current edit (after the first bounty). Ask if something is unclear












  • 1





    Maybe related: tex.stackexchange.com/questions/68251/…

    – Steven B. Segletes
    Mar 20 at 16:26






  • 2





    Not a solution, but if you are looking into this I would try to use tcolorbox instead of mdframed. tcolorbox is actively maintained and has an awesome manual while mdframed development seems to have stalled a while ago.

    – moewe
    Mar 20 at 16:31






  • 2





    @sheß Could you clarify? One can indeed put enumerations inside the embed. So are you looking to suspend the embed to provide a response and then continue the enumeration where it left off?

    – Steven B. Segletes
    Mar 20 at 16:37






  • 1





    What if you just draw a line on the left margin (using a suitably prepared background image perhaps), and use your defined response environment to draw a box with a white border on the left to cover up the pre-drawn line?

    – Willie Wong
    Mar 21 at 13:31






  • 1





    Isn't this an instance of a XY problem, where your actual ultimate objective is to nicely add your comment on a document submitted to you? If so, you might want to have a look at the todonotes package. (I.e. this package doesn't do the "bar in the left margin" thing, but might be of greater help for what you ultimately want to do. See notably inline notes.) See also changes package.

    – ebosi
    Mar 28 at 11:13


















10















Edit: I am not happy with the 3 answers my first, smaller bounty got me. So I rewrote the question to set clear rules and a proper bounty.





The solution should create two environments, originalemail and response with the following effects:




  • Text in the originalemail is typeset in a way that slightly (4pt) indents all text and adds a vertical line on the left.

  • The response environment can only be used inside the environment and results in the vertical line being broken and the text being aligned on the left without the originalemails indentation. What is more, the response has to be aligned to the same margin on the left, irrespective of where in the originalemail it is placed (e.g., be within a (nested) itemize or enumerate).


Summary




  • leave the layout of the original email in-tact (it should be possible to use sections, lists, paragraphs, floats, etc. as if it as was a plain TeX document and there were no responses and the numbering should be the same with and without respones)

  • using these environments should require no editing of the code outside the response environment. In particular any suspension or resume of enumerate or itemize environments, if required by the solution should be automatic.

  • The only way in which the original layout should change is that it show vertical line (2pt) on the left margin and ideally a slight indentation (4pt).

  • responses and the fragments of the original email have to break pages as normal. (if you use parbox for the responses they wont)

  • allow to insert replys anywhere in the the original text

  • bonus if the solution is nesteable (i.e. the outer originalemail contains an older originalemail and responses)


Rules: for the bounty, you're free to build on the existing answers, i.e. @marmot's/Gonzalo Medina's TikZ approach to draw the line in the left margin, @Vinccool96's tcolorbox or my own rudimentary approach to automatically suspending and resuming lists.



Screenshot from Gmail that roughly summarizes what I need:
enter image description here










share|improve this question

















This question has an open bounty worth +500
reputation from sheß ending in 5 days.


This question has not received enough attention.


The bounty winner should address all the points raised in the current edit (after the first bounty). Ask if something is unclear












  • 1





    Maybe related: tex.stackexchange.com/questions/68251/…

    – Steven B. Segletes
    Mar 20 at 16:26






  • 2





    Not a solution, but if you are looking into this I would try to use tcolorbox instead of mdframed. tcolorbox is actively maintained and has an awesome manual while mdframed development seems to have stalled a while ago.

    – moewe
    Mar 20 at 16:31






  • 2





    @sheß Could you clarify? One can indeed put enumerations inside the embed. So are you looking to suspend the embed to provide a response and then continue the enumeration where it left off?

    – Steven B. Segletes
    Mar 20 at 16:37






  • 1





    What if you just draw a line on the left margin (using a suitably prepared background image perhaps), and use your defined response environment to draw a box with a white border on the left to cover up the pre-drawn line?

    – Willie Wong
    Mar 21 at 13:31






  • 1





    Isn't this an instance of a XY problem, where your actual ultimate objective is to nicely add your comment on a document submitted to you? If so, you might want to have a look at the todonotes package. (I.e. this package doesn't do the "bar in the left margin" thing, but might be of greater help for what you ultimately want to do. See notably inline notes.) See also changes package.

    – ebosi
    Mar 28 at 11:13
















10












10








10


1






Edit: I am not happy with the 3 answers my first, smaller bounty got me. So I rewrote the question to set clear rules and a proper bounty.





The solution should create two environments, originalemail and response with the following effects:




  • Text in the originalemail is typeset in a way that slightly (4pt) indents all text and adds a vertical line on the left.

  • The response environment can only be used inside the environment and results in the vertical line being broken and the text being aligned on the left without the originalemails indentation. What is more, the response has to be aligned to the same margin on the left, irrespective of where in the originalemail it is placed (e.g., be within a (nested) itemize or enumerate).


Summary




  • leave the layout of the original email in-tact (it should be possible to use sections, lists, paragraphs, floats, etc. as if it as was a plain TeX document and there were no responses and the numbering should be the same with and without respones)

  • using these environments should require no editing of the code outside the response environment. In particular any suspension or resume of enumerate or itemize environments, if required by the solution should be automatic.

  • The only way in which the original layout should change is that it show vertical line (2pt) on the left margin and ideally a slight indentation (4pt).

  • responses and the fragments of the original email have to break pages as normal. (if you use parbox for the responses they wont)

  • allow to insert replys anywhere in the the original text

  • bonus if the solution is nesteable (i.e. the outer originalemail contains an older originalemail and responses)


Rules: for the bounty, you're free to build on the existing answers, i.e. @marmot's/Gonzalo Medina's TikZ approach to draw the line in the left margin, @Vinccool96's tcolorbox or my own rudimentary approach to automatically suspending and resuming lists.



Screenshot from Gmail that roughly summarizes what I need:
enter image description here










share|improve this question
















Edit: I am not happy with the 3 answers my first, smaller bounty got me. So I rewrote the question to set clear rules and a proper bounty.





The solution should create two environments, originalemail and response with the following effects:




  • Text in the originalemail is typeset in a way that slightly (4pt) indents all text and adds a vertical line on the left.

  • The response environment can only be used inside the environment and results in the vertical line being broken and the text being aligned on the left without the originalemails indentation. What is more, the response has to be aligned to the same margin on the left, irrespective of where in the originalemail it is placed (e.g., be within a (nested) itemize or enumerate).


Summary




  • leave the layout of the original email in-tact (it should be possible to use sections, lists, paragraphs, floats, etc. as if it as was a plain TeX document and there were no responses and the numbering should be the same with and without respones)

  • using these environments should require no editing of the code outside the response environment. In particular any suspension or resume of enumerate or itemize environments, if required by the solution should be automatic.

  • The only way in which the original layout should change is that it show vertical line (2pt) on the left margin and ideally a slight indentation (4pt).

  • responses and the fragments of the original email have to break pages as normal. (if you use parbox for the responses they wont)

  • allow to insert replys anywhere in the the original text

  • bonus if the solution is nesteable (i.e. the outer originalemail contains an older originalemail and responses)


Rules: for the bounty, you're free to build on the existing answers, i.e. @marmot's/Gonzalo Medina's TikZ approach to draw the line in the left margin, @Vinccool96's tcolorbox or my own rudimentary approach to automatically suspending and resuming lists.



Screenshot from Gmail that roughly summarizes what I need:
enter image description here







marginpar layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 17 hours ago







sheß

















asked Mar 20 at 16:24









sheßsheß

2,00711436




2,00711436






This question has an open bounty worth +500
reputation from sheß ending in 5 days.


This question has not received enough attention.


The bounty winner should address all the points raised in the current edit (after the first bounty). Ask if something is unclear








This question has an open bounty worth +500
reputation from sheß ending in 5 days.


This question has not received enough attention.


The bounty winner should address all the points raised in the current edit (after the first bounty). Ask if something is unclear










  • 1





    Maybe related: tex.stackexchange.com/questions/68251/…

    – Steven B. Segletes
    Mar 20 at 16:26






  • 2





    Not a solution, but if you are looking into this I would try to use tcolorbox instead of mdframed. tcolorbox is actively maintained and has an awesome manual while mdframed development seems to have stalled a while ago.

    – moewe
    Mar 20 at 16:31






  • 2





    @sheß Could you clarify? One can indeed put enumerations inside the embed. So are you looking to suspend the embed to provide a response and then continue the enumeration where it left off?

    – Steven B. Segletes
    Mar 20 at 16:37






  • 1





    What if you just draw a line on the left margin (using a suitably prepared background image perhaps), and use your defined response environment to draw a box with a white border on the left to cover up the pre-drawn line?

    – Willie Wong
    Mar 21 at 13:31






  • 1





    Isn't this an instance of a XY problem, where your actual ultimate objective is to nicely add your comment on a document submitted to you? If so, you might want to have a look at the todonotes package. (I.e. this package doesn't do the "bar in the left margin" thing, but might be of greater help for what you ultimately want to do. See notably inline notes.) See also changes package.

    – ebosi
    Mar 28 at 11:13
















  • 1





    Maybe related: tex.stackexchange.com/questions/68251/…

    – Steven B. Segletes
    Mar 20 at 16:26






  • 2





    Not a solution, but if you are looking into this I would try to use tcolorbox instead of mdframed. tcolorbox is actively maintained and has an awesome manual while mdframed development seems to have stalled a while ago.

    – moewe
    Mar 20 at 16:31






  • 2





    @sheß Could you clarify? One can indeed put enumerations inside the embed. So are you looking to suspend the embed to provide a response and then continue the enumeration where it left off?

    – Steven B. Segletes
    Mar 20 at 16:37






  • 1





    What if you just draw a line on the left margin (using a suitably prepared background image perhaps), and use your defined response environment to draw a box with a white border on the left to cover up the pre-drawn line?

    – Willie Wong
    Mar 21 at 13:31






  • 1





    Isn't this an instance of a XY problem, where your actual ultimate objective is to nicely add your comment on a document submitted to you? If so, you might want to have a look at the todonotes package. (I.e. this package doesn't do the "bar in the left margin" thing, but might be of greater help for what you ultimately want to do. See notably inline notes.) See also changes package.

    – ebosi
    Mar 28 at 11:13










1




1





Maybe related: tex.stackexchange.com/questions/68251/…

– Steven B. Segletes
Mar 20 at 16:26





Maybe related: tex.stackexchange.com/questions/68251/…

– Steven B. Segletes
Mar 20 at 16:26




2




2





Not a solution, but if you are looking into this I would try to use tcolorbox instead of mdframed. tcolorbox is actively maintained and has an awesome manual while mdframed development seems to have stalled a while ago.

– moewe
Mar 20 at 16:31





Not a solution, but if you are looking into this I would try to use tcolorbox instead of mdframed. tcolorbox is actively maintained and has an awesome manual while mdframed development seems to have stalled a while ago.

– moewe
Mar 20 at 16:31




2




2





@sheß Could you clarify? One can indeed put enumerations inside the embed. So are you looking to suspend the embed to provide a response and then continue the enumeration where it left off?

– Steven B. Segletes
Mar 20 at 16:37





@sheß Could you clarify? One can indeed put enumerations inside the embed. So are you looking to suspend the embed to provide a response and then continue the enumeration where it left off?

– Steven B. Segletes
Mar 20 at 16:37




1




1





What if you just draw a line on the left margin (using a suitably prepared background image perhaps), and use your defined response environment to draw a box with a white border on the left to cover up the pre-drawn line?

– Willie Wong
Mar 21 at 13:31





What if you just draw a line on the left margin (using a suitably prepared background image perhaps), and use your defined response environment to draw a box with a white border on the left to cover up the pre-drawn line?

– Willie Wong
Mar 21 at 13:31




1




1





Isn't this an instance of a XY problem, where your actual ultimate objective is to nicely add your comment on a document submitted to you? If so, you might want to have a look at the todonotes package. (I.e. this package doesn't do the "bar in the left margin" thing, but might be of greater help for what you ultimately want to do. See notably inline notes.) See also changes package.

– ebosi
Mar 28 at 11:13







Isn't this an instance of a XY problem, where your actual ultimate objective is to nicely add your comment on a document submitted to you? If so, you might want to have a look at the todonotes package. (I.e. this package doesn't do the "bar in the left margin" thing, but might be of greater help for what you ultimately want to do. See notably inline notes.) See also changes package.

– ebosi
Mar 28 at 11:13












3 Answers
3






active

oldest

votes


















4





+50









documentclass{article}

usepackage[most]{tcolorbox}
tcbuselibrary{breakable}
tcbuselibrary{skins}

newtcolorbox{emailstart}[3]{%
standard jigsaw,
opacityframe=0,
opacityback=0,
colback=transparent,
grow to left by=-1.5em,
boxrule=0pt,
boxsep=0pt,
breakable,
enhanced jigsaw,
title={On #2, #3 wrotepar},
coltitle={black},
attach title to upper={},
borderline west={4pt}{0pt}{black},
overlay unbroken and first={draw[shorten >=1.4pt, shorten <=1.4pt] ([yshift=-1.5em]frame.north west) -- ([yshift=-1.5em]frame.north east);},
#1,
}

newtcolorbox{emailresume}[1]{%
standard jigsaw,
opacityframe=0,
opacityback=0,
colback=transparent,
grow to left by=-1.5em,
boxrule=0pt,
boxsep=0pt,
breakable,
enhanced jigsaw,
borderline west={4pt}{0pt}{black},
#1,
}

newcounter{enumicounter} %counter that will save the enumeration counter

begin{document}
begin{emailstart}{2019}{Einstein}
begin{emailstart}{2018}{Sheß}
Text Text Text Text

Text Text Text Text Text Text Text
end{emailstart}
Here I am putting my answer text
end{emailstart}
Oh, now I see your point


begin{emailresume}
begin{emailresume}
section{A section}
Some content a list
begin{enumerate}
item One
setcounter{enumicounter}{value{enumi}} % save the enumeration counter
end{enumerate}
end{emailresume}
Here even more, there's no indentation, because you closed the enumaration and the email
end{emailresume}
This is an answer to your answer
begin{emailresume}
begin{emailresume}
begin{enumerate}
setcounter{enumi}{value{enumicounter}} % continue the enumeration
item Two
setcounter{enumicounter}{value{enumi}} %save the enumeration counter
end{enumerate}
end{emailresume}
Answer
begin{emailresume}
begin{enumerate}
setcounter{enumi}{value{enumicounter}} % continue the enumeration
item Three
item Four
setcounter{enumicounter}{value{enumi}} %save the enumeration counter
end{enumerate}
section{another section}
More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
subsection{a subsection}
More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
end{emailresume}
More
begin{emailresume}
subsection{another subsection}
More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
end{emailresume}
More
begin{emailresume}
Bye,

Sheß
end{emailresume}
Bye,

Einstein
end{emailresume}
Bye
end{document}







share|improve this answer


























  • So what you want is to get it with the indentation, except when you specifiy there's an answer?

    – Vinccool96
    Mar 23 at 23:03











  • I modified my answer

    – Vinccool96
    Mar 25 at 16:20











  • That's because it's in an enumerate environment. You'll need to add a end{enumerate} before response and a begin{enumerate} after.

    – Vinccool96
    Mar 26 at 16:07











  • Again edited. Is it good now?

    – Vinccool96
    Mar 27 at 16:39











  • I proposed you something first where you only had to specify to resume the enumeration, but you rejected it.

    – Vinccool96
    Mar 28 at 16:48



















2














All I did here is to slightly modify Gonzalo Medina's nice answer. One can of course tune it a bit more. (I also understand that there is nothing squiggly here, I was too lazy to rename the macros.)



documentclass{article}
usepackage{refcount}
usepackage{tikz}
usetikzlibrary{calc,tikzmark}
usepackage{lipsum}

newcounter{tmp}
% newcommandtikzmark[1]{%
% tikz[overlay,remember picture] node (#1) {};}

newcommandStartsquiggly{%
stepcounter{tmp}%
tikzmarknode{a}{strut}label{athetmp}%
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
begin{tikzpicture}[overlay, remember picture]
draw [ultra thick,gray]
let p1 = (a.south), p2 = (b), p3 = (current page.center) in
( $ (x3,y1) + (-.55textwidth,0) $ ) -- ( $ (x3,y3) + (-0.55textwidth,-0.5textheight) $ );
end{tikzpicture}%
fi%
}

newcommandEndsquiggly{%
tikzmarknode{b}{strut}label{bthetmp}
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
begin{tikzpicture}[overlay, remember picture]
draw [ultra thick,gray]
let p1 = (a.south), p2 = (b), p3 = (current page.center) in
( $ (x3,y1) + (-.55textwidth,1em) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
end{tikzpicture}%
else
begin{tikzpicture}[overlay, remember picture]
draw [ultra thick,gray]
let p1 = (a.south), p2 = (b), p3 = (current page.center) in
( $ (x3,y3) + (-.55textwidth,.5textheight) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
end{tikzpicture}%
fi
}

newcommandSqu[1]{Startsquiggly#1Endsquiggly}
AtBeginDocument{Startsquiggly}
AtEndDocument{parEndsquiggly}
newcommand{response}[1]{parEndsquiggly#1parStartsquiggly}
begin{document}
Some text, with pictures, lists, sections
begin{enumerate}
item Some text, with pictures, lists, sections
response{answer1}
item Some text, with pictures, lists, sections
response{answer2}
end{enumerate}
Some text, with pictures, lists, sections
response{this is my answer}
Some text, with pictures, lists, sections
section{section}
subsection{subsection1}
Some text, with pictures, lists, sections
subsection{subsection2}
Some text, with pictures, lists, sections
subsection{subsection3}
Some text, with pictures, lists, sections
response{I also have an answer here}
More text
end{document}


enter image description here






share|improve this answer



















  • 1





    @sheß Absolutely. Please note that there are also many posts linked to Gonzalo's nice answer, some of which may become relevant if you have something like raggedbottom and so on. (I really just very quickly wrote that before I went cycling, there are many things one may want to add/consider/improve.)

    – marmot
    Mar 23 at 23:14











  • @sheß This point I do not understand. There are two things: (1) Draw the interrupted line on the margin and (2) add indentation. I didn't know you want to have (2) (which is clearer after the edit). So you wish to indent sections and so on? (In this case the question is very different from what I originally thought it is.) Or only texts as in the email conversation?

    – marmot
    Mar 28 at 17:30






  • 1





    Whoever downvoted this answer may want to take into account that this was an attempt to answer the question before the edit(s).

    – marmot
    2 days ago











  • Sorry, I missed the grace period and the bounty was out awarded

    – sheß
    yesterday



















1














A solution I came up with, but I'm still fairly unhappy with the amount of things that are hard-coded. E.g.




  • it requires that I change all begin{enumerate}[some arguments] to begin{enumerate}{some arguments}

  • works only for up to a fixed number of nested enumerates and

  • probably fails if the original document uses an itemize or something else.

  • it cannot be nested


So, eventhough I'm posting this as an aswer to my own post, I do not consider this complete and would be happy for anyone who adapts it to be more general



documentclass{article}

newcounter{breakdepth}
usepackage{enumitem}
usepackage{letltxmacro}

%redefine enumerates so that they are automatically resumable
LetLtxMacroooenumerateenumerate
LetLtxMacroendooenumerateendenumerate
makeatletter
renewenvironment{enumerate}[2][0]{%
ifx0#1%i.e. this is not a resume, but a new list, so start naming it.
ooenumerate[series=levelthe@enumdepth,#2]%
else
ooenumerate[#2]%
fi
}{
endooenumerate%
}
%define the command that breaks the report environment, closes all enumerates, but resumes them afterwards
newcommand{response}[1]{%
setcounter{breakdepth}{the@enumdepth}%
ifnumvalue{breakdepth}>3 end{enumerate} fi%
ifnumvalue{breakdepth}>2 end{enumerate} fi%
ifnumvalue{breakdepth}>1 end{enumerate} fi%
ifnumvalue{breakdepth}>0 end{enumerate} fi%
end{report}%
#1%
begin{report}%
ifnumvalue{breakdepth}>0 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
ifnumvalue{breakdepth}>1 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
ifnumvalue{breakdepth}>2 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
ifnumvalue{breakdepth}>3 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
}
makeatother
%define the environment that has a slight indentation and a vertical line for the original text
usepackage{mdframed}
newenvironment{report}{begin{mdframed}[linewidth=1pt,topline=false,rightline=false,bottomline=false,linecolor=black,innerleftmargin =0cm, leftmargin=2pt,innerrightmargin=1pt]}{end{mdframed}}

begin{document}
begin{report}
section{first section}
begin{enumerate}{label=roman*.}
item ione
begin{enumerate}{}
item aone
%%%%%%%%%
response{test}
%%%%%%%%%
item atwo
end{enumerate}
item itwo
response{test}
end{enumerate}
section{a section}
Some text that is not inside a list
response{test}
more text
end{report}
end{document}


enter image description here






share|improve this answer


























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480526%2fimitate-email-reply-layout-vertical-line-in-left-margin-except-for-responses%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4





    +50









    documentclass{article}

    usepackage[most]{tcolorbox}
    tcbuselibrary{breakable}
    tcbuselibrary{skins}

    newtcolorbox{emailstart}[3]{%
    standard jigsaw,
    opacityframe=0,
    opacityback=0,
    colback=transparent,
    grow to left by=-1.5em,
    boxrule=0pt,
    boxsep=0pt,
    breakable,
    enhanced jigsaw,
    title={On #2, #3 wrotepar},
    coltitle={black},
    attach title to upper={},
    borderline west={4pt}{0pt}{black},
    overlay unbroken and first={draw[shorten >=1.4pt, shorten <=1.4pt] ([yshift=-1.5em]frame.north west) -- ([yshift=-1.5em]frame.north east);},
    #1,
    }

    newtcolorbox{emailresume}[1]{%
    standard jigsaw,
    opacityframe=0,
    opacityback=0,
    colback=transparent,
    grow to left by=-1.5em,
    boxrule=0pt,
    boxsep=0pt,
    breakable,
    enhanced jigsaw,
    borderline west={4pt}{0pt}{black},
    #1,
    }

    newcounter{enumicounter} %counter that will save the enumeration counter

    begin{document}
    begin{emailstart}{2019}{Einstein}
    begin{emailstart}{2018}{Sheß}
    Text Text Text Text

    Text Text Text Text Text Text Text
    end{emailstart}
    Here I am putting my answer text
    end{emailstart}
    Oh, now I see your point


    begin{emailresume}
    begin{emailresume}
    section{A section}
    Some content a list
    begin{enumerate}
    item One
    setcounter{enumicounter}{value{enumi}} % save the enumeration counter
    end{enumerate}
    end{emailresume}
    Here even more, there's no indentation, because you closed the enumaration and the email
    end{emailresume}
    This is an answer to your answer
    begin{emailresume}
    begin{emailresume}
    begin{enumerate}
    setcounter{enumi}{value{enumicounter}} % continue the enumeration
    item Two
    setcounter{enumicounter}{value{enumi}} %save the enumeration counter
    end{enumerate}
    end{emailresume}
    Answer
    begin{emailresume}
    begin{enumerate}
    setcounter{enumi}{value{enumicounter}} % continue the enumeration
    item Three
    item Four
    setcounter{enumicounter}{value{enumi}} %save the enumeration counter
    end{enumerate}
    section{another section}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    subsection{a subsection}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    end{emailresume}
    More
    begin{emailresume}
    subsection{another subsection}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    end{emailresume}
    More
    begin{emailresume}
    Bye,

    Sheß
    end{emailresume}
    Bye,

    Einstein
    end{emailresume}
    Bye
    end{document}







    share|improve this answer


























    • So what you want is to get it with the indentation, except when you specifiy there's an answer?

      – Vinccool96
      Mar 23 at 23:03











    • I modified my answer

      – Vinccool96
      Mar 25 at 16:20











    • That's because it's in an enumerate environment. You'll need to add a end{enumerate} before response and a begin{enumerate} after.

      – Vinccool96
      Mar 26 at 16:07











    • Again edited. Is it good now?

      – Vinccool96
      Mar 27 at 16:39











    • I proposed you something first where you only had to specify to resume the enumeration, but you rejected it.

      – Vinccool96
      Mar 28 at 16:48
















    4





    +50









    documentclass{article}

    usepackage[most]{tcolorbox}
    tcbuselibrary{breakable}
    tcbuselibrary{skins}

    newtcolorbox{emailstart}[3]{%
    standard jigsaw,
    opacityframe=0,
    opacityback=0,
    colback=transparent,
    grow to left by=-1.5em,
    boxrule=0pt,
    boxsep=0pt,
    breakable,
    enhanced jigsaw,
    title={On #2, #3 wrotepar},
    coltitle={black},
    attach title to upper={},
    borderline west={4pt}{0pt}{black},
    overlay unbroken and first={draw[shorten >=1.4pt, shorten <=1.4pt] ([yshift=-1.5em]frame.north west) -- ([yshift=-1.5em]frame.north east);},
    #1,
    }

    newtcolorbox{emailresume}[1]{%
    standard jigsaw,
    opacityframe=0,
    opacityback=0,
    colback=transparent,
    grow to left by=-1.5em,
    boxrule=0pt,
    boxsep=0pt,
    breakable,
    enhanced jigsaw,
    borderline west={4pt}{0pt}{black},
    #1,
    }

    newcounter{enumicounter} %counter that will save the enumeration counter

    begin{document}
    begin{emailstart}{2019}{Einstein}
    begin{emailstart}{2018}{Sheß}
    Text Text Text Text

    Text Text Text Text Text Text Text
    end{emailstart}
    Here I am putting my answer text
    end{emailstart}
    Oh, now I see your point


    begin{emailresume}
    begin{emailresume}
    section{A section}
    Some content a list
    begin{enumerate}
    item One
    setcounter{enumicounter}{value{enumi}} % save the enumeration counter
    end{enumerate}
    end{emailresume}
    Here even more, there's no indentation, because you closed the enumaration and the email
    end{emailresume}
    This is an answer to your answer
    begin{emailresume}
    begin{emailresume}
    begin{enumerate}
    setcounter{enumi}{value{enumicounter}} % continue the enumeration
    item Two
    setcounter{enumicounter}{value{enumi}} %save the enumeration counter
    end{enumerate}
    end{emailresume}
    Answer
    begin{emailresume}
    begin{enumerate}
    setcounter{enumi}{value{enumicounter}} % continue the enumeration
    item Three
    item Four
    setcounter{enumicounter}{value{enumi}} %save the enumeration counter
    end{enumerate}
    section{another section}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    subsection{a subsection}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    end{emailresume}
    More
    begin{emailresume}
    subsection{another subsection}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    end{emailresume}
    More
    begin{emailresume}
    Bye,

    Sheß
    end{emailresume}
    Bye,

    Einstein
    end{emailresume}
    Bye
    end{document}







    share|improve this answer


























    • So what you want is to get it with the indentation, except when you specifiy there's an answer?

      – Vinccool96
      Mar 23 at 23:03











    • I modified my answer

      – Vinccool96
      Mar 25 at 16:20











    • That's because it's in an enumerate environment. You'll need to add a end{enumerate} before response and a begin{enumerate} after.

      – Vinccool96
      Mar 26 at 16:07











    • Again edited. Is it good now?

      – Vinccool96
      Mar 27 at 16:39











    • I proposed you something first where you only had to specify to resume the enumeration, but you rejected it.

      – Vinccool96
      Mar 28 at 16:48














    4





    +50







    4





    +50



    4




    +50





    documentclass{article}

    usepackage[most]{tcolorbox}
    tcbuselibrary{breakable}
    tcbuselibrary{skins}

    newtcolorbox{emailstart}[3]{%
    standard jigsaw,
    opacityframe=0,
    opacityback=0,
    colback=transparent,
    grow to left by=-1.5em,
    boxrule=0pt,
    boxsep=0pt,
    breakable,
    enhanced jigsaw,
    title={On #2, #3 wrotepar},
    coltitle={black},
    attach title to upper={},
    borderline west={4pt}{0pt}{black},
    overlay unbroken and first={draw[shorten >=1.4pt, shorten <=1.4pt] ([yshift=-1.5em]frame.north west) -- ([yshift=-1.5em]frame.north east);},
    #1,
    }

    newtcolorbox{emailresume}[1]{%
    standard jigsaw,
    opacityframe=0,
    opacityback=0,
    colback=transparent,
    grow to left by=-1.5em,
    boxrule=0pt,
    boxsep=0pt,
    breakable,
    enhanced jigsaw,
    borderline west={4pt}{0pt}{black},
    #1,
    }

    newcounter{enumicounter} %counter that will save the enumeration counter

    begin{document}
    begin{emailstart}{2019}{Einstein}
    begin{emailstart}{2018}{Sheß}
    Text Text Text Text

    Text Text Text Text Text Text Text
    end{emailstart}
    Here I am putting my answer text
    end{emailstart}
    Oh, now I see your point


    begin{emailresume}
    begin{emailresume}
    section{A section}
    Some content a list
    begin{enumerate}
    item One
    setcounter{enumicounter}{value{enumi}} % save the enumeration counter
    end{enumerate}
    end{emailresume}
    Here even more, there's no indentation, because you closed the enumaration and the email
    end{emailresume}
    This is an answer to your answer
    begin{emailresume}
    begin{emailresume}
    begin{enumerate}
    setcounter{enumi}{value{enumicounter}} % continue the enumeration
    item Two
    setcounter{enumicounter}{value{enumi}} %save the enumeration counter
    end{enumerate}
    end{emailresume}
    Answer
    begin{emailresume}
    begin{enumerate}
    setcounter{enumi}{value{enumicounter}} % continue the enumeration
    item Three
    item Four
    setcounter{enumicounter}{value{enumi}} %save the enumeration counter
    end{enumerate}
    section{another section}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    subsection{a subsection}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    end{emailresume}
    More
    begin{emailresume}
    subsection{another subsection}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    end{emailresume}
    More
    begin{emailresume}
    Bye,

    Sheß
    end{emailresume}
    Bye,

    Einstein
    end{emailresume}
    Bye
    end{document}







    share|improve this answer















    documentclass{article}

    usepackage[most]{tcolorbox}
    tcbuselibrary{breakable}
    tcbuselibrary{skins}

    newtcolorbox{emailstart}[3]{%
    standard jigsaw,
    opacityframe=0,
    opacityback=0,
    colback=transparent,
    grow to left by=-1.5em,
    boxrule=0pt,
    boxsep=0pt,
    breakable,
    enhanced jigsaw,
    title={On #2, #3 wrotepar},
    coltitle={black},
    attach title to upper={},
    borderline west={4pt}{0pt}{black},
    overlay unbroken and first={draw[shorten >=1.4pt, shorten <=1.4pt] ([yshift=-1.5em]frame.north west) -- ([yshift=-1.5em]frame.north east);},
    #1,
    }

    newtcolorbox{emailresume}[1]{%
    standard jigsaw,
    opacityframe=0,
    opacityback=0,
    colback=transparent,
    grow to left by=-1.5em,
    boxrule=0pt,
    boxsep=0pt,
    breakable,
    enhanced jigsaw,
    borderline west={4pt}{0pt}{black},
    #1,
    }

    newcounter{enumicounter} %counter that will save the enumeration counter

    begin{document}
    begin{emailstart}{2019}{Einstein}
    begin{emailstart}{2018}{Sheß}
    Text Text Text Text

    Text Text Text Text Text Text Text
    end{emailstart}
    Here I am putting my answer text
    end{emailstart}
    Oh, now I see your point


    begin{emailresume}
    begin{emailresume}
    section{A section}
    Some content a list
    begin{enumerate}
    item One
    setcounter{enumicounter}{value{enumi}} % save the enumeration counter
    end{enumerate}
    end{emailresume}
    Here even more, there's no indentation, because you closed the enumaration and the email
    end{emailresume}
    This is an answer to your answer
    begin{emailresume}
    begin{emailresume}
    begin{enumerate}
    setcounter{enumi}{value{enumicounter}} % continue the enumeration
    item Two
    setcounter{enumicounter}{value{enumi}} %save the enumeration counter
    end{enumerate}
    end{emailresume}
    Answer
    begin{emailresume}
    begin{enumerate}
    setcounter{enumi}{value{enumicounter}} % continue the enumeration
    item Three
    item Four
    setcounter{enumicounter}{value{enumi}} %save the enumeration counter
    end{enumerate}
    section{another section}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    subsection{a subsection}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    end{emailresume}
    More
    begin{emailresume}
    subsection{another subsection}
    More Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
    end{emailresume}
    More
    begin{emailresume}
    Bye,

    Sheß
    end{emailresume}
    Bye,

    Einstein
    end{emailresume}
    Bye
    end{document}








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited yesterday









    sheß

    2,00711436




    2,00711436










    answered Mar 23 at 17:59









    Vinccool96Vinccool96

    50211




    50211













    • So what you want is to get it with the indentation, except when you specifiy there's an answer?

      – Vinccool96
      Mar 23 at 23:03











    • I modified my answer

      – Vinccool96
      Mar 25 at 16:20











    • That's because it's in an enumerate environment. You'll need to add a end{enumerate} before response and a begin{enumerate} after.

      – Vinccool96
      Mar 26 at 16:07











    • Again edited. Is it good now?

      – Vinccool96
      Mar 27 at 16:39











    • I proposed you something first where you only had to specify to resume the enumeration, but you rejected it.

      – Vinccool96
      Mar 28 at 16:48



















    • So what you want is to get it with the indentation, except when you specifiy there's an answer?

      – Vinccool96
      Mar 23 at 23:03











    • I modified my answer

      – Vinccool96
      Mar 25 at 16:20











    • That's because it's in an enumerate environment. You'll need to add a end{enumerate} before response and a begin{enumerate} after.

      – Vinccool96
      Mar 26 at 16:07











    • Again edited. Is it good now?

      – Vinccool96
      Mar 27 at 16:39











    • I proposed you something first where you only had to specify to resume the enumeration, but you rejected it.

      – Vinccool96
      Mar 28 at 16:48

















    So what you want is to get it with the indentation, except when you specifiy there's an answer?

    – Vinccool96
    Mar 23 at 23:03





    So what you want is to get it with the indentation, except when you specifiy there's an answer?

    – Vinccool96
    Mar 23 at 23:03













    I modified my answer

    – Vinccool96
    Mar 25 at 16:20





    I modified my answer

    – Vinccool96
    Mar 25 at 16:20













    That's because it's in an enumerate environment. You'll need to add a end{enumerate} before response and a begin{enumerate} after.

    – Vinccool96
    Mar 26 at 16:07





    That's because it's in an enumerate environment. You'll need to add a end{enumerate} before response and a begin{enumerate} after.

    – Vinccool96
    Mar 26 at 16:07













    Again edited. Is it good now?

    – Vinccool96
    Mar 27 at 16:39





    Again edited. Is it good now?

    – Vinccool96
    Mar 27 at 16:39













    I proposed you something first where you only had to specify to resume the enumeration, but you rejected it.

    – Vinccool96
    Mar 28 at 16:48





    I proposed you something first where you only had to specify to resume the enumeration, but you rejected it.

    – Vinccool96
    Mar 28 at 16:48











    2














    All I did here is to slightly modify Gonzalo Medina's nice answer. One can of course tune it a bit more. (I also understand that there is nothing squiggly here, I was too lazy to rename the macros.)



    documentclass{article}
    usepackage{refcount}
    usepackage{tikz}
    usetikzlibrary{calc,tikzmark}
    usepackage{lipsum}

    newcounter{tmp}
    % newcommandtikzmark[1]{%
    % tikz[overlay,remember picture] node (#1) {};}

    newcommandStartsquiggly{%
    stepcounter{tmp}%
    tikzmarknode{a}{strut}label{athetmp}%
    ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y1) + (-.55textwidth,0) $ ) -- ( $ (x3,y3) + (-0.55textwidth,-0.5textheight) $ );
    end{tikzpicture}%
    fi%
    }

    newcommandEndsquiggly{%
    tikzmarknode{b}{strut}label{bthetmp}
    ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y1) + (-.55textwidth,1em) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
    end{tikzpicture}%
    else
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y3) + (-.55textwidth,.5textheight) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
    end{tikzpicture}%
    fi
    }

    newcommandSqu[1]{Startsquiggly#1Endsquiggly}
    AtBeginDocument{Startsquiggly}
    AtEndDocument{parEndsquiggly}
    newcommand{response}[1]{parEndsquiggly#1parStartsquiggly}
    begin{document}
    Some text, with pictures, lists, sections
    begin{enumerate}
    item Some text, with pictures, lists, sections
    response{answer1}
    item Some text, with pictures, lists, sections
    response{answer2}
    end{enumerate}
    Some text, with pictures, lists, sections
    response{this is my answer}
    Some text, with pictures, lists, sections
    section{section}
    subsection{subsection1}
    Some text, with pictures, lists, sections
    subsection{subsection2}
    Some text, with pictures, lists, sections
    subsection{subsection3}
    Some text, with pictures, lists, sections
    response{I also have an answer here}
    More text
    end{document}


    enter image description here






    share|improve this answer



















    • 1





      @sheß Absolutely. Please note that there are also many posts linked to Gonzalo's nice answer, some of which may become relevant if you have something like raggedbottom and so on. (I really just very quickly wrote that before I went cycling, there are many things one may want to add/consider/improve.)

      – marmot
      Mar 23 at 23:14











    • @sheß This point I do not understand. There are two things: (1) Draw the interrupted line on the margin and (2) add indentation. I didn't know you want to have (2) (which is clearer after the edit). So you wish to indent sections and so on? (In this case the question is very different from what I originally thought it is.) Or only texts as in the email conversation?

      – marmot
      Mar 28 at 17:30






    • 1





      Whoever downvoted this answer may want to take into account that this was an attempt to answer the question before the edit(s).

      – marmot
      2 days ago











    • Sorry, I missed the grace period and the bounty was out awarded

      – sheß
      yesterday
















    2














    All I did here is to slightly modify Gonzalo Medina's nice answer. One can of course tune it a bit more. (I also understand that there is nothing squiggly here, I was too lazy to rename the macros.)



    documentclass{article}
    usepackage{refcount}
    usepackage{tikz}
    usetikzlibrary{calc,tikzmark}
    usepackage{lipsum}

    newcounter{tmp}
    % newcommandtikzmark[1]{%
    % tikz[overlay,remember picture] node (#1) {};}

    newcommandStartsquiggly{%
    stepcounter{tmp}%
    tikzmarknode{a}{strut}label{athetmp}%
    ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y1) + (-.55textwidth,0) $ ) -- ( $ (x3,y3) + (-0.55textwidth,-0.5textheight) $ );
    end{tikzpicture}%
    fi%
    }

    newcommandEndsquiggly{%
    tikzmarknode{b}{strut}label{bthetmp}
    ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y1) + (-.55textwidth,1em) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
    end{tikzpicture}%
    else
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y3) + (-.55textwidth,.5textheight) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
    end{tikzpicture}%
    fi
    }

    newcommandSqu[1]{Startsquiggly#1Endsquiggly}
    AtBeginDocument{Startsquiggly}
    AtEndDocument{parEndsquiggly}
    newcommand{response}[1]{parEndsquiggly#1parStartsquiggly}
    begin{document}
    Some text, with pictures, lists, sections
    begin{enumerate}
    item Some text, with pictures, lists, sections
    response{answer1}
    item Some text, with pictures, lists, sections
    response{answer2}
    end{enumerate}
    Some text, with pictures, lists, sections
    response{this is my answer}
    Some text, with pictures, lists, sections
    section{section}
    subsection{subsection1}
    Some text, with pictures, lists, sections
    subsection{subsection2}
    Some text, with pictures, lists, sections
    subsection{subsection3}
    Some text, with pictures, lists, sections
    response{I also have an answer here}
    More text
    end{document}


    enter image description here






    share|improve this answer



















    • 1





      @sheß Absolutely. Please note that there are also many posts linked to Gonzalo's nice answer, some of which may become relevant if you have something like raggedbottom and so on. (I really just very quickly wrote that before I went cycling, there are many things one may want to add/consider/improve.)

      – marmot
      Mar 23 at 23:14











    • @sheß This point I do not understand. There are two things: (1) Draw the interrupted line on the margin and (2) add indentation. I didn't know you want to have (2) (which is clearer after the edit). So you wish to indent sections and so on? (In this case the question is very different from what I originally thought it is.) Or only texts as in the email conversation?

      – marmot
      Mar 28 at 17:30






    • 1





      Whoever downvoted this answer may want to take into account that this was an attempt to answer the question before the edit(s).

      – marmot
      2 days ago











    • Sorry, I missed the grace period and the bounty was out awarded

      – sheß
      yesterday














    2












    2








    2







    All I did here is to slightly modify Gonzalo Medina's nice answer. One can of course tune it a bit more. (I also understand that there is nothing squiggly here, I was too lazy to rename the macros.)



    documentclass{article}
    usepackage{refcount}
    usepackage{tikz}
    usetikzlibrary{calc,tikzmark}
    usepackage{lipsum}

    newcounter{tmp}
    % newcommandtikzmark[1]{%
    % tikz[overlay,remember picture] node (#1) {};}

    newcommandStartsquiggly{%
    stepcounter{tmp}%
    tikzmarknode{a}{strut}label{athetmp}%
    ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y1) + (-.55textwidth,0) $ ) -- ( $ (x3,y3) + (-0.55textwidth,-0.5textheight) $ );
    end{tikzpicture}%
    fi%
    }

    newcommandEndsquiggly{%
    tikzmarknode{b}{strut}label{bthetmp}
    ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y1) + (-.55textwidth,1em) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
    end{tikzpicture}%
    else
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y3) + (-.55textwidth,.5textheight) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
    end{tikzpicture}%
    fi
    }

    newcommandSqu[1]{Startsquiggly#1Endsquiggly}
    AtBeginDocument{Startsquiggly}
    AtEndDocument{parEndsquiggly}
    newcommand{response}[1]{parEndsquiggly#1parStartsquiggly}
    begin{document}
    Some text, with pictures, lists, sections
    begin{enumerate}
    item Some text, with pictures, lists, sections
    response{answer1}
    item Some text, with pictures, lists, sections
    response{answer2}
    end{enumerate}
    Some text, with pictures, lists, sections
    response{this is my answer}
    Some text, with pictures, lists, sections
    section{section}
    subsection{subsection1}
    Some text, with pictures, lists, sections
    subsection{subsection2}
    Some text, with pictures, lists, sections
    subsection{subsection3}
    Some text, with pictures, lists, sections
    response{I also have an answer here}
    More text
    end{document}


    enter image description here






    share|improve this answer













    All I did here is to slightly modify Gonzalo Medina's nice answer. One can of course tune it a bit more. (I also understand that there is nothing squiggly here, I was too lazy to rename the macros.)



    documentclass{article}
    usepackage{refcount}
    usepackage{tikz}
    usetikzlibrary{calc,tikzmark}
    usepackage{lipsum}

    newcounter{tmp}
    % newcommandtikzmark[1]{%
    % tikz[overlay,remember picture] node (#1) {};}

    newcommandStartsquiggly{%
    stepcounter{tmp}%
    tikzmarknode{a}{strut}label{athetmp}%
    ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y1) + (-.55textwidth,0) $ ) -- ( $ (x3,y3) + (-0.55textwidth,-0.5textheight) $ );
    end{tikzpicture}%
    fi%
    }

    newcommandEndsquiggly{%
    tikzmarknode{b}{strut}label{bthetmp}
    ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y1) + (-.55textwidth,1em) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
    end{tikzpicture}%
    else
    begin{tikzpicture}[overlay, remember picture]
    draw [ultra thick,gray]
    let p1 = (a.south), p2 = (b), p3 = (current page.center) in
    ( $ (x3,y3) + (-.55textwidth,.5textheight) $ ) -- ( $ (x3,y2) + (-.55textwidth,1em) $ );
    end{tikzpicture}%
    fi
    }

    newcommandSqu[1]{Startsquiggly#1Endsquiggly}
    AtBeginDocument{Startsquiggly}
    AtEndDocument{parEndsquiggly}
    newcommand{response}[1]{parEndsquiggly#1parStartsquiggly}
    begin{document}
    Some text, with pictures, lists, sections
    begin{enumerate}
    item Some text, with pictures, lists, sections
    response{answer1}
    item Some text, with pictures, lists, sections
    response{answer2}
    end{enumerate}
    Some text, with pictures, lists, sections
    response{this is my answer}
    Some text, with pictures, lists, sections
    section{section}
    subsection{subsection1}
    Some text, with pictures, lists, sections
    subsection{subsection2}
    Some text, with pictures, lists, sections
    subsection{subsection3}
    Some text, with pictures, lists, sections
    response{I also have an answer here}
    More text
    end{document}


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 23 at 19:47









    marmotmarmot

    113k5145275




    113k5145275








    • 1





      @sheß Absolutely. Please note that there are also many posts linked to Gonzalo's nice answer, some of which may become relevant if you have something like raggedbottom and so on. (I really just very quickly wrote that before I went cycling, there are many things one may want to add/consider/improve.)

      – marmot
      Mar 23 at 23:14











    • @sheß This point I do not understand. There are two things: (1) Draw the interrupted line on the margin and (2) add indentation. I didn't know you want to have (2) (which is clearer after the edit). So you wish to indent sections and so on? (In this case the question is very different from what I originally thought it is.) Or only texts as in the email conversation?

      – marmot
      Mar 28 at 17:30






    • 1





      Whoever downvoted this answer may want to take into account that this was an attempt to answer the question before the edit(s).

      – marmot
      2 days ago











    • Sorry, I missed the grace period and the bounty was out awarded

      – sheß
      yesterday














    • 1





      @sheß Absolutely. Please note that there are also many posts linked to Gonzalo's nice answer, some of which may become relevant if you have something like raggedbottom and so on. (I really just very quickly wrote that before I went cycling, there are many things one may want to add/consider/improve.)

      – marmot
      Mar 23 at 23:14











    • @sheß This point I do not understand. There are two things: (1) Draw the interrupted line on the margin and (2) add indentation. I didn't know you want to have (2) (which is clearer after the edit). So you wish to indent sections and so on? (In this case the question is very different from what I originally thought it is.) Or only texts as in the email conversation?

      – marmot
      Mar 28 at 17:30






    • 1





      Whoever downvoted this answer may want to take into account that this was an attempt to answer the question before the edit(s).

      – marmot
      2 days ago











    • Sorry, I missed the grace period and the bounty was out awarded

      – sheß
      yesterday








    1




    1





    @sheß Absolutely. Please note that there are also many posts linked to Gonzalo's nice answer, some of which may become relevant if you have something like raggedbottom and so on. (I really just very quickly wrote that before I went cycling, there are many things one may want to add/consider/improve.)

    – marmot
    Mar 23 at 23:14





    @sheß Absolutely. Please note that there are also many posts linked to Gonzalo's nice answer, some of which may become relevant if you have something like raggedbottom and so on. (I really just very quickly wrote that before I went cycling, there are many things one may want to add/consider/improve.)

    – marmot
    Mar 23 at 23:14













    @sheß This point I do not understand. There are two things: (1) Draw the interrupted line on the margin and (2) add indentation. I didn't know you want to have (2) (which is clearer after the edit). So you wish to indent sections and so on? (In this case the question is very different from what I originally thought it is.) Or only texts as in the email conversation?

    – marmot
    Mar 28 at 17:30





    @sheß This point I do not understand. There are two things: (1) Draw the interrupted line on the margin and (2) add indentation. I didn't know you want to have (2) (which is clearer after the edit). So you wish to indent sections and so on? (In this case the question is very different from what I originally thought it is.) Or only texts as in the email conversation?

    – marmot
    Mar 28 at 17:30




    1




    1





    Whoever downvoted this answer may want to take into account that this was an attempt to answer the question before the edit(s).

    – marmot
    2 days ago





    Whoever downvoted this answer may want to take into account that this was an attempt to answer the question before the edit(s).

    – marmot
    2 days ago













    Sorry, I missed the grace period and the bounty was out awarded

    – sheß
    yesterday





    Sorry, I missed the grace period and the bounty was out awarded

    – sheß
    yesterday











    1














    A solution I came up with, but I'm still fairly unhappy with the amount of things that are hard-coded. E.g.




    • it requires that I change all begin{enumerate}[some arguments] to begin{enumerate}{some arguments}

    • works only for up to a fixed number of nested enumerates and

    • probably fails if the original document uses an itemize or something else.

    • it cannot be nested


    So, eventhough I'm posting this as an aswer to my own post, I do not consider this complete and would be happy for anyone who adapts it to be more general



    documentclass{article}

    newcounter{breakdepth}
    usepackage{enumitem}
    usepackage{letltxmacro}

    %redefine enumerates so that they are automatically resumable
    LetLtxMacroooenumerateenumerate
    LetLtxMacroendooenumerateendenumerate
    makeatletter
    renewenvironment{enumerate}[2][0]{%
    ifx0#1%i.e. this is not a resume, but a new list, so start naming it.
    ooenumerate[series=levelthe@enumdepth,#2]%
    else
    ooenumerate[#2]%
    fi
    }{
    endooenumerate%
    }
    %define the command that breaks the report environment, closes all enumerates, but resumes them afterwards
    newcommand{response}[1]{%
    setcounter{breakdepth}{the@enumdepth}%
    ifnumvalue{breakdepth}>3 end{enumerate} fi%
    ifnumvalue{breakdepth}>2 end{enumerate} fi%
    ifnumvalue{breakdepth}>1 end{enumerate} fi%
    ifnumvalue{breakdepth}>0 end{enumerate} fi%
    end{report}%
    #1%
    begin{report}%
    ifnumvalue{breakdepth}>0 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
    ifnumvalue{breakdepth}>1 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
    ifnumvalue{breakdepth}>2 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
    ifnumvalue{breakdepth}>3 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
    }
    makeatother
    %define the environment that has a slight indentation and a vertical line for the original text
    usepackage{mdframed}
    newenvironment{report}{begin{mdframed}[linewidth=1pt,topline=false,rightline=false,bottomline=false,linecolor=black,innerleftmargin =0cm, leftmargin=2pt,innerrightmargin=1pt]}{end{mdframed}}

    begin{document}
    begin{report}
    section{first section}
    begin{enumerate}{label=roman*.}
    item ione
    begin{enumerate}{}
    item aone
    %%%%%%%%%
    response{test}
    %%%%%%%%%
    item atwo
    end{enumerate}
    item itwo
    response{test}
    end{enumerate}
    section{a section}
    Some text that is not inside a list
    response{test}
    more text
    end{report}
    end{document}


    enter image description here






    share|improve this answer






























      1














      A solution I came up with, but I'm still fairly unhappy with the amount of things that are hard-coded. E.g.




      • it requires that I change all begin{enumerate}[some arguments] to begin{enumerate}{some arguments}

      • works only for up to a fixed number of nested enumerates and

      • probably fails if the original document uses an itemize or something else.

      • it cannot be nested


      So, eventhough I'm posting this as an aswer to my own post, I do not consider this complete and would be happy for anyone who adapts it to be more general



      documentclass{article}

      newcounter{breakdepth}
      usepackage{enumitem}
      usepackage{letltxmacro}

      %redefine enumerates so that they are automatically resumable
      LetLtxMacroooenumerateenumerate
      LetLtxMacroendooenumerateendenumerate
      makeatletter
      renewenvironment{enumerate}[2][0]{%
      ifx0#1%i.e. this is not a resume, but a new list, so start naming it.
      ooenumerate[series=levelthe@enumdepth,#2]%
      else
      ooenumerate[#2]%
      fi
      }{
      endooenumerate%
      }
      %define the command that breaks the report environment, closes all enumerates, but resumes them afterwards
      newcommand{response}[1]{%
      setcounter{breakdepth}{the@enumdepth}%
      ifnumvalue{breakdepth}>3 end{enumerate} fi%
      ifnumvalue{breakdepth}>2 end{enumerate} fi%
      ifnumvalue{breakdepth}>1 end{enumerate} fi%
      ifnumvalue{breakdepth}>0 end{enumerate} fi%
      end{report}%
      #1%
      begin{report}%
      ifnumvalue{breakdepth}>0 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
      ifnumvalue{breakdepth}>1 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
      ifnumvalue{breakdepth}>2 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
      ifnumvalue{breakdepth}>3 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
      }
      makeatother
      %define the environment that has a slight indentation and a vertical line for the original text
      usepackage{mdframed}
      newenvironment{report}{begin{mdframed}[linewidth=1pt,topline=false,rightline=false,bottomline=false,linecolor=black,innerleftmargin =0cm, leftmargin=2pt,innerrightmargin=1pt]}{end{mdframed}}

      begin{document}
      begin{report}
      section{first section}
      begin{enumerate}{label=roman*.}
      item ione
      begin{enumerate}{}
      item aone
      %%%%%%%%%
      response{test}
      %%%%%%%%%
      item atwo
      end{enumerate}
      item itwo
      response{test}
      end{enumerate}
      section{a section}
      Some text that is not inside a list
      response{test}
      more text
      end{report}
      end{document}


      enter image description here






      share|improve this answer




























        1












        1








        1







        A solution I came up with, but I'm still fairly unhappy with the amount of things that are hard-coded. E.g.




        • it requires that I change all begin{enumerate}[some arguments] to begin{enumerate}{some arguments}

        • works only for up to a fixed number of nested enumerates and

        • probably fails if the original document uses an itemize or something else.

        • it cannot be nested


        So, eventhough I'm posting this as an aswer to my own post, I do not consider this complete and would be happy for anyone who adapts it to be more general



        documentclass{article}

        newcounter{breakdepth}
        usepackage{enumitem}
        usepackage{letltxmacro}

        %redefine enumerates so that they are automatically resumable
        LetLtxMacroooenumerateenumerate
        LetLtxMacroendooenumerateendenumerate
        makeatletter
        renewenvironment{enumerate}[2][0]{%
        ifx0#1%i.e. this is not a resume, but a new list, so start naming it.
        ooenumerate[series=levelthe@enumdepth,#2]%
        else
        ooenumerate[#2]%
        fi
        }{
        endooenumerate%
        }
        %define the command that breaks the report environment, closes all enumerates, but resumes them afterwards
        newcommand{response}[1]{%
        setcounter{breakdepth}{the@enumdepth}%
        ifnumvalue{breakdepth}>3 end{enumerate} fi%
        ifnumvalue{breakdepth}>2 end{enumerate} fi%
        ifnumvalue{breakdepth}>1 end{enumerate} fi%
        ifnumvalue{breakdepth}>0 end{enumerate} fi%
        end{report}%
        #1%
        begin{report}%
        ifnumvalue{breakdepth}>0 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
        ifnumvalue{breakdepth}>1 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
        ifnumvalue{breakdepth}>2 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
        ifnumvalue{breakdepth}>3 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
        }
        makeatother
        %define the environment that has a slight indentation and a vertical line for the original text
        usepackage{mdframed}
        newenvironment{report}{begin{mdframed}[linewidth=1pt,topline=false,rightline=false,bottomline=false,linecolor=black,innerleftmargin =0cm, leftmargin=2pt,innerrightmargin=1pt]}{end{mdframed}}

        begin{document}
        begin{report}
        section{first section}
        begin{enumerate}{label=roman*.}
        item ione
        begin{enumerate}{}
        item aone
        %%%%%%%%%
        response{test}
        %%%%%%%%%
        item atwo
        end{enumerate}
        item itwo
        response{test}
        end{enumerate}
        section{a section}
        Some text that is not inside a list
        response{test}
        more text
        end{report}
        end{document}


        enter image description here






        share|improve this answer















        A solution I came up with, but I'm still fairly unhappy with the amount of things that are hard-coded. E.g.




        • it requires that I change all begin{enumerate}[some arguments] to begin{enumerate}{some arguments}

        • works only for up to a fixed number of nested enumerates and

        • probably fails if the original document uses an itemize or something else.

        • it cannot be nested


        So, eventhough I'm posting this as an aswer to my own post, I do not consider this complete and would be happy for anyone who adapts it to be more general



        documentclass{article}

        newcounter{breakdepth}
        usepackage{enumitem}
        usepackage{letltxmacro}

        %redefine enumerates so that they are automatically resumable
        LetLtxMacroooenumerateenumerate
        LetLtxMacroendooenumerateendenumerate
        makeatletter
        renewenvironment{enumerate}[2][0]{%
        ifx0#1%i.e. this is not a resume, but a new list, so start naming it.
        ooenumerate[series=levelthe@enumdepth,#2]%
        else
        ooenumerate[#2]%
        fi
        }{
        endooenumerate%
        }
        %define the command that breaks the report environment, closes all enumerates, but resumes them afterwards
        newcommand{response}[1]{%
        setcounter{breakdepth}{the@enumdepth}%
        ifnumvalue{breakdepth}>3 end{enumerate} fi%
        ifnumvalue{breakdepth}>2 end{enumerate} fi%
        ifnumvalue{breakdepth}>1 end{enumerate} fi%
        ifnumvalue{breakdepth}>0 end{enumerate} fi%
        end{report}%
        #1%
        begin{report}%
        ifnumvalue{breakdepth}>0 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
        ifnumvalue{breakdepth}>1 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
        ifnumvalue{breakdepth}>2 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
        ifnumvalue{breakdepth}>3 begin{enumerate}{resume*=levelthe@enumdepth}itemfi%
        }
        makeatother
        %define the environment that has a slight indentation and a vertical line for the original text
        usepackage{mdframed}
        newenvironment{report}{begin{mdframed}[linewidth=1pt,topline=false,rightline=false,bottomline=false,linecolor=black,innerleftmargin =0cm, leftmargin=2pt,innerrightmargin=1pt]}{end{mdframed}}

        begin{document}
        begin{report}
        section{first section}
        begin{enumerate}{label=roman*.}
        item ione
        begin{enumerate}{}
        item aone
        %%%%%%%%%
        response{test}
        %%%%%%%%%
        item atwo
        end{enumerate}
        item itwo
        response{test}
        end{enumerate}
        section{a section}
        Some text that is not inside a list
        response{test}
        more text
        end{report}
        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 29 at 17:45

























        answered Mar 29 at 13:49









        sheßsheß

        2,00711436




        2,00711436






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480526%2fimitate-email-reply-layout-vertical-line-in-left-margin-except-for-responses%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?