LaTeX forum ⇒ Text FormattingMaking Sense of Code Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
User avatar
cgnieder
Site Moderator
Posts: 1974
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:

Re: Making Sense of Code  Topic is solved

Postby cgnieder » Thu Sep 10, 2015 4:08 pm

LaTexLearner wrote:What I meant about 3cm of space was 3cm of vertical space. Maybe this would have two horizontal rules all the way across or maybe not. Is that possible?


My suggestion would be to use \answerline macro only for usage in the current text flow. For bigger chunks that need some vertical space I'd suggest defining an environment. I'll post something later.

LaTexLearner wrote:Also, what is the "adapted proposal" you mentioned?


I meant this viewtopic.php?f=44&t=26667&sid=0c044fd412559bd4bd83853fd5c8d494#p91512 but it sounds like I misunderstood your question.
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3587
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Sep 10, 2015 4:17 pm

Currently, the macro for an answer is meant for single words, not for paragraphs of text. I am not quite sure what you are trying to achieve? Maybe have a look at package exsheets, it is customizable and great for doing exam sheets and similar stuff.

  1. \documentclass{article}
  2. \begin{document}
  3. Is there a question?\phantom{42}Really?
  4.  
  5. Is there a question?42Really?
  6.  
  7. \rule{0pt}{3cm}
  8.  
  9. Hello? Anybody here?
  10.  
  11. \vspace{4cm}
  12.  
  13. Anybody? Where is everyone?
  14. \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
cgnieder
Site Moderator
Posts: 1974
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:

Postby cgnieder » Thu Sep 10, 2015 4:22 pm

Johannes_B wrote:I am not quite sure what you are trying to achieve?

This will become clear with a little history :)

LaTeXLearner asked a question over at TeX.se (actually using the exsheets package) and I gave an answer. In the comments he asked whether we could discuss the code so I suggested to do that here since a forum is much better suited for discussions.

Best
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

LaTexLearner
Posts: 138
Joined: Tue Mar 10, 2015 11:06 am

Postby LaTexLearner » Sat Sep 12, 2015 2:24 am

cgnieder wrote:
LaTexLearner wrote:What I meant about 3cm of space was 3cm of vertical space. Maybe this would have two horizontal rules all the way across or maybe not. Is that possible?


My suggestion would be to use \answerline macro only for usage in the current text flow. For bigger chunks that need some vertical space I'd suggest defining an environment. I'll post something later.


I think that I understand the majority of this thread well enough, with the exception of all the @ use which sounds pretty complicated.

I've started a new thread for longer answers. (I posted it on here; not sure if it should have gone on tex.stackexchange instead... this forum seems easier to use, though. :) )

User avatar
Stefan Kottwitz
Site Admin
Posts: 8541
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sat Sep 12, 2015 3:51 pm

Hi,

LaTexLearner wrote:not sure if it should have gone on tex.stackexchange instead... this forum seems easier to use, though. :) )


I'm on tex.stackexchange too. But since a while I rarely post there. I like talking here in the LaTeX Community forum, it feels more free to me and I feel relaxed here, not so on stackexchange with strict rules, often closing questions and such.

Stefan
Site admin

LaTexLearner
Posts: 138
Joined: Tue Mar 10, 2015 11:06 am

Postby LaTexLearner » Sat Sep 26, 2015 11:39 pm

cgnieder wrote:
LaTexLearner wrote:Also, is there any way to set the answer space so that the default length is, say, 2cm, but there is an optional argument to make it longer?


One possibility: change the definition of \answerline like this:
  1. \newcommand\answerline[2][\answerspace]{%
  2. \begingroup
  3. \ifdim#1=\answerspace
  4. \else
  5. \setlength\answerspace{#1}%
  6. \fi
  7. \ifmmode
  8. \answerline@math{#2}%
  9. \else
  10. \answerline@text{#2}%
  11. \fi
  12. \endgroup
  13. }


I'm trying to adjust this code so that if there is a sequence of fill-in-the-blank exercises, the first one is an example, i.e. already filled in regardless of the setting of \SetupExSheets{...}.

I tried the code below, but it did not seem to work. I also imagine there is a more elegant way to begin the code instead of using #1 twice in the first line.

The goal was to have it make this macro \exampleline[optional length]{filled in text}

  1. \newcommand\example[1]{\PrintSolutionsTF{#1}{#1}}
  2.  
  3. \newcommand\exampleline[2][\answerspace]{ % \answerspace is defined above
  4. \begingroup
  5. \ifdim#1=\answerspace
  6. \else
  7. \setlength\answerspace{#1}%
  8. \fi
  9. \ifmmode
  10. \answerline@math{#2}%
  11. \else
  12. \answerline@text{#2}%
  13. \fi
  14. \endgroup
  15. }


Return to “Text Formatting”

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests