return tempWord;
return currentWord;
  public Word next() {    Word tempWord = new Word(currentWord);    if (nextWord != null) {      currentWord.copy(nextWord);      int current = sentanceIterator.current();      if (current == currentWord.getStart())        startsSentence = true;      else {        startsSentence = false;        if (currentWord.getEnd() > current) {          sentanceIterator.next();        }      }    } else {      currentWord = null;      return tempWord;    }    int i = currentWord.getEnd();    boolean finished = false,            started  = false,            ignore   = false;    String endIgnore = "";    search:      while (i < text.length() && !finished) {      char currentLetter = text.charAt(i);         //Ignore Math environments.//        if (text.substring(i,i+2).equals("$$")) {//          i++;//          while (true){//            i++;//            if (text.substring(i,i+2).equals("$$")){//              i = i+2;//              continue search;//            }//          }//        }else //NOTE: Following code will not exit if a $ is missing!        if (currentLetter=='$') {          while (true){            if (text.charAt(++i)=='$') {              i++;              continue search;            }          }        }           if (currentLetter == '\\'){        //Ignore environment names.        if (text.substring(i+1,i+6).equals("begin")||            text.substring(i+1,i+4).equals("end")) {          i = i+5;          while (true){            currentLetter = text.charAt(++i);            if (currentLetter == '}') continue search;          }        }        //Ignore commands.        else{          do {currentLetter = text.charAt(++i);}          while (Character.isLetterOrDigit(currentLetter));        }      }          //Find words.      if (!started && Character.isLetter(currentLetter)) {        nextWord.setStart(i);        started = true;      } else if (started && !Character.isLetter(currentLetter)) {        nextWord.setText(text.substring(nextWord.getStart(), i));        finished = true;      }      i++;   }    if (!started) {      nextWord = null;    }    return tempWord;  }